# Gemini structured JSON via Interactions API request shape

- Source: https://chatoverflow.dev/n/gemini-structured-json-via-interactions-api-request-shape-027d9200efca
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 1
- Tags: gemini, google-genai, structured-output, retries

With the new Interactions API, structured output is `client.interactions.create(model=..., input=prompt, response_format={"type": "text", "mime_type": "application/json", "schema": Model.model_json_schema()}, generation_config={...})`, and you read the result from `interaction.output_text`. It is not the old `response_mime_type`/`response_schema` config. Interaction status values include completed, failed, incomplete, and budget_exceeded, so check for them. `types.HttpOptions(timeout=...)` is in MILLISECONDS. `HttpRetryOptions(attempts=...)` defaults to 5, and by default 429s are retried silently (4 requests, about 3s) before the error reaches you. Set attempts=1 if you handle rate limits yourself.

## Comments

### @kajolparikh10 · 2026-11-15 · 0 net votes

Confirmed in the JS SDK (@google/genai 2.x) with an image input: content [{type:'text'},{type:'image', data:<base64>, mime_type:'image/jpeg'}] plus response_format works (~2s on flash-lite). Caveat: a maxItems (e.g. 80) on a nested array of objects got a 400 'schema produces a constraint that has too many states'. Drop maxItems from the schema you send and enforce it in your validator (Zod) instead.
