Gemini structured output (Vertex AI / Agent Platform)
Constrain Gemini output to a JSON schema or a single enum value (response_mime_type text/x.enum) with response_schema. Google Cloud now documents this under the Gemini Enterprise Agent Platform name. No probabilities are documented on the structured-output page.1
PricingUSD, as published
| Item | Value |
|---|---|
| List price | 3.8 Flash $0.75/1M in23 |
| Free tier | Not published |
Per-token Gemini pricing; for example Gemini 3.8 Flash is $0.75 / $3.75 per 1M input/output tokens (introductory, through 2026-12-31), then $1.50 / $7.50 from 2027-01-01 (non-global endpoints cost 10% more). The response schema counts toward the input token limit.23 [Verified 2026-11-11 on https://cloud.google.com/vertex-ai/generative-ai/pricing (no change) and https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generated-output]
New: Gemini 4 Carbon and Gemini 4 Argon (Standard tier, global endpoint) cost $2 input / $10 output per 1M tokens through Nov 30, 2026 (promotional, paid as 50% credits back on net spend), then $4 / $20 from Dec 1, 2026; non-global endpoints cost 10% more and the Cyber Permissive variants get no promotion. From Nov 13, 2026, a Gemini 4 completion longer than 32K tokens is billed for retrievable tokens even if the request then fails on a timeout.2 [Verified 2026-11-11 on https://cloud.google.com/vertex-ai/generative-ai/pricing]
Estimate cost at 10k to 10M requests, or set your own usage.
LimitsPer request
| Limit | Value |
|---|---|
| Context window | 1,048,576 (3.8 Flash) |
| Rate limit | Usage tiers (PayGo) |
Response schema size counts toward the input token limit; schema must be defined via the API (no console support).3 [Verified 2026-11-11 on https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generated-output (page last updated 2026-11-10)]
StatusBeta
- Changed: the supported-models list now adds Gemini 4 Carbon and Gemini 4 Carbon for cyber, next to Gemini 4 Argon and Gemini 4 Argon Cyber Permissive, Gemini 3.8 Flash and 3.8 Flash Cyber, 3.7 Flash, 3.6 Flash, 3.5 Flash and Flash-Lite, Gemini 3.1 Flash-Lite, Gemini 3.1 Pro and Gemini 3 Flash (preview), Gemini Robotics ER 2 (preview) and Gemini 2.5 Pro, Flash and Flash-Lite. It also lists open models: DeepSeek-V4.1-Flash, Gemma 4 26B A4B IT, GLM 5.2, Llama 4 Maverick and Scout, and gpt-oss 120B.3 [Verified 2026-11-11 on https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generated-output (page last updated 2026-11-10)]
- Correction: an earlier version of this page said you could read logprobs alongside the enum. The structured output page does not mention logprobs, so no probabilities are documented for this path. [Correction logged 2026-10-16]
Auth
| Method | API key or ADC |
| Details | Google Cloud credentials: Vertex docs offer an API key or Application Default Credentials (gcloud auth). [Verified 2026-10-16 on cloud.google.com Vertex AI docs (Get an API key / Configure application default credentials)] |
FeaturesFrom lib/apiFeatures.js
| Capability | State |
|---|---|
| BatchBatch inference supported | Yes1 |
| Structured JSON outputresponse_schema JSON or enum | Yes |
| Tool / function callingFunction calling supported | Yes1 |
| StreamingSchemas work with streamGenerateContent | Yes4 |
| MCP supportRemote MCP server (/mcp/generate) | Yes5 |
| Fine-tuningTuning on 3.5 Flash, 2.5 models | Yes6 |
| Official SDKsPython, Go, Node.js, Java | Yes4 |
| SLA published99.5% Gemini inference SLA | Yes7 |
| EU / data residencyeu multi-region ML processing | Yes1 |
| Free tierNo Gemini free tier on Vertex pricing | Not published281 |
| Open source / self-hostNo self-hosting option documented | Not published281 |
Fit and safety
Watch out
- text/x.enum approximates a choice API but returns one label with no per-option probability on the page we checked; calibration is yours to build.
- Same pattern applies: deterministic rules own hard constraints; the model is advisory; fail closed on errors.
How it works
- Set response_schema plus response_mime_type "application/json" for schema-valid JSON, or "text/x.enum" to force one value from an enum (Google’s example classifies an instrument into one of five labels).
- Google warns JSON mode without a response_schema is only a strong hint and can return malformed JSON.
- Complex schemas (long property names, big enums, many optional properties) can fail with a 400 InvalidArgument error.
Compare
Put Gemini structured output (Vertex AI / Agent Platform) side by side with other APIs on price, limits and features. Open the comparison table →
Deciding between a decision model and a generative LLM? See Decision model vs LLM: when to use which.
SourcesFootnotes
- 1cloud.google.com/vertex-ai/generative-ai/docs/models/gemini/3-8-flashcloud.google.com/vertex-ai/generative-ai/docs/models/gemini/3-8-flashVerified 2026-10-16
- 2Google Cloud: Agent Platform generative AI pricingcloud.google.com/vertex-ai/generative-ai/pricingVerified 2026-11-11
- 3Google Cloud: Structured outputcloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-generatVerified 2026-11-11
- 4docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-gedocs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/control-geVerified 2026-10-16
- 5docs.cloud.google.com/gemini-enterprise-agent-platform/reference/mcpdocs.cloud.google.com/gemini-enterprise-agent-platform/reference/mcpVerified 2026-10-16
- 6cloud.google.com/vertex-ai/generative-ai/docs/models/tune-modelscloud.google.com/vertex-ai/generative-ai/docs/models/tune-modelsVerified 2026-10-16
- 7cloud.google.com/vertex-ai/generative-ai/slacloud.google.com/vertex-ai/generative-ai/slaVerified 2026-10-16
- 8cloud.google.com/free/docs/free-cloud-featurescloud.google.com/free/docs/free-cloud-featuresChecked 2026-10-16