Interactions API: output tokens exceed max_output_tokens=1500

Please help clarify output limits and usage reporting for gemini-3.8-flash.

Endpoint:
POST /v1beta/interactions

Input: one JPEG image and a text prompt.
Local request attempts: 1; automatic retries: 0.

The saved client code and request metadata specify:
generation_config:
max_output_tokens: 1500
thinking_level: low
store: false
stream: false

HTTP response: 200
Model: gemini-3.8-flash
Status: incomplete

Saved raw response usage:
total_input_tokens: 1431
total_output_tokens: 2079
total_thought_tokens: 0
total_tokens: 3510
raw_prompt_token: 1464

The nested model_invocation_token_counts reports:
text candidate tokens: 2083

Our client copies the usage fields directly, without recalculating or accumulating them. We do not have an independent capture of the transmitted request, so the saved code alone cannot prove which parameters the server received.

Questions:

  1. What exactly does max_output_tokens limit for this model and endpoint?
  2. Is there a documented reason why total_output_tokens could exceed 1500?
  3. Why do total_output_tokens (2079) and candidate tokens (2083) differ? Which fields determine billing?
  4. Which response fields identify the specific reason for an incomplete result?

Further tests are paused. Please advise on the minimum sanitized diagnostic information needed. No API key, image, or full response is attached.

Hello @BINGE ,

  1. max_output_tokens scope: Caps combined thought and answer tokens. Reaching it stops generation with status: "incomplete".
  2. Why output reached 2,079: store and stream are top-level fields, not part of generation_config. When placed inside generation_config, custom limits do not apply and the default limit is used. Use this structure:
{
  "model": "gemini-3.8-flash",
  "input": "<prompt>",
  "store": false,
  "stream": false,
  "generation_config": {
    "max_output_tokens": 1500,
    "thinking_level": "low"
  }
}

  1. Billing (2,079 vs 2,083): Billing uses only the usage object (total_output_tokens: 2079 + total_thought_tokens: 0). Other counts include internal tokens that are not billed.
  2. Incomplete status: status: "incomplete" with an empty errors array confirms the token limit caused the stop.