# Gemini 4 Carbon API on TokenRa Model ID: `gemini-4-carbon` Get an API key: https://tokenra.io/register?utm_source=llms-agent&utm_medium=model-llms Updated: 2026-12-02 > Gemini 4 Carbon is Google's strongest Gemini 4 model, announced on October 28, 2026 and generally available on November 10. On TokenRa it answers through OpenAI Chat Completions with function calling and streaming. - Provider: Google - Type: Text model - API formats: Chat Completions - Input: Text, image - Output: Text ## Pricing Rates in the TokenRa console when this file was last updated, in US dollars for the default group. The live price list is authoritative: https://tokenra.io/pricing (JSON: https://tokenra.io/api/pricing). - `gemini-4-carbon`: $4.80 per 1M input tokens, $24.00 per 1M output tokens, $0.24 per 1M cached input tokens ## Capabilities & endpoints Chat generation through OpenAI Chat Completions. Each endpoint below was called successfully on tokenra.io on 2026-12-02. - `POST https://tokenra.io/v1/chat/completions`: OpenAI SDK with `base_url="https://tokenra.io/v1"`. Auth: `Authorization: Bearer`. Recommended. **Formats not available** - Anthropic Messages (`/v1/messages`): the model is published on the HTTP gateway with the `openai` endpoint type only. - OpenAI Responses (`/v1/responses`) is not exposed either. ## Example Set `TOKENRA_API_KEY` to your API key first. The docs page has the same example in Python, JavaScript and Java. ```bash curl https://tokenra.io/v1/chat/completions \ -H "Authorization: Bearer $TOKENRA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gemini-4-carbon", "stream": false, "messages": [ {"role": "system", "content": "You are a concise technical assistant."}, {"role": "user", "content": "Explain in two sentences what an API gateway does."} ] }' ``` ## Request parameters Fields for `POST /v1/chat/completions`. Everything listed was accepted by the model in testing. | Parameter | Type | Required | Description | | --- | --- | --- | --- | | `model` | string | Yes | The model ID to call, for example `gemini-4-carbon`. | | `messages` | array | Yes | Conversation messages in order (system, user, assistant, tool). `content` can be a string or an array of `text` and `image_url` parts. | | `stream` | boolean | No | Defaults to true. Omit the field and the reply is `text/event-stream`; send `false` to get one JSON body. | | `stream_options` | object | No | With `{"include_usage": true}` the last chunk carries `usage` and an empty `choices` array. | | `tools` | array | No | Supported. A request with a `tools` array returns `tool_calls` with parsed JSON arguments and `finish_reason: stop`. | | `max_tokens` | integer | No | Upper limit for all generated tokens, reasoning included. Reasoning tokens count toward it where the model reasons. | | `temperature` | number | No | Sampling temperature. | | `top_p` | number | No | Nucleus sampling threshold. Usually tune either this or temperature. | | `presence_penalty` | number | No | Penalises tokens that already appeared, nudging the model toward new topics. | | `frequency_penalty` | number | No | Penalises frequent tokens to reduce repetition. | | `user` | string | No | Your own end-user identifier for auditing or abuse handling. It is not part of the conversation. | ## Response format **Example response** ```json { "id": "chatcmpl-20261202084412000000000carbon", "object": "chat.completion", "created": 1796172254, "model": "gemini-4-carbon", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "An API gateway is a single entry point that routes, secures and monitors requests between clients and backend services, applying shared policies such as authentication, rate limiting and logging." }, "finish_reason": "stop" } ], "usage": { "prompt_tokens": 41, "completion_tokens": 44, "total_tokens": 85, "prompt_tokens_details": { "cached_tokens": 0 }, "completion_tokens_details": { "reasoning_tokens": 0 } } } ``` | Field | Type | Description | | --- | --- | --- | | `id` | string | Completion ID. Include it when you contact support. | | `object` | string | `chat.completion`, or `chat.completion.chunk` when streaming. | | `created` | integer | Unix timestamp in seconds. | | `model` | string | The model that produced the answer. | | `choices[].message.content` | string | The answer text. | | `choices[].finish_reason` | string | `stop` or `length`; a tool call still comes back with `finish_reason: stop`. | | `usage` | object | `prompt_tokens`, `completion_tokens`, `total_tokens`, plus `prompt_tokens_details.cached_tokens` and `completion_tokens_details.reasoning_tokens`. | **Streaming is the default on this model.** If `stream` is omitted the reply is `text/event-stream`; send `stream: false` to get one JSON body. With streaming, the answer arrives as `data:` lines of `chat.completion.chunk` objects and ends with `data: [DONE]`. ## Errors & limits ### Common errors | HTTP | error.code | Meaning | What to do | | --- | --- | --- | --- | | `401` | - | Missing, wrong or deleted API key. The message is `Invalid token`. | Check the `Authorization: Bearer` header and the key in the console. | | `400` | - | The body is not valid JSON. | Fix the JSON and send `Content-Type: application/json`. | | `500` | `invalid_request` | A required field is missing, for example `messages`. | Add the field named in the message. Retrying will not help. | | `403` | `insufficient_user_quota` | Your balance or plan quota is used up. | Top up in the console, then retry. | | `503` | `model_not_found` | Unknown model ID, or no channel serves it for your group. | Check the ID in the model list or with `GET /v1/models`. | | `429` | - | Too many requests. | Back off exponentially and retry. | | `5xx` | - | The upstream provider failed or timed out. | Retry a few times; keep the request id if it persists. | ### Limits and notes - Image input was tested with an `image_url` part pointing at a public HTTPS image; the model read it correctly. - In testing it returned no reasoning tokens (`completion_tokens_details.reasoning_tokens` was 0). - `stream` defaults to true: code that expects one JSON body must send `stream: false`. - With `tools`, the reply carries `tool_calls` but `finish_reason` stays `stop`. ## More - [Gemini 4 Carbon API docs page](https://tokenra.io/docs/gemini-4-carbon.html): parameter tables and code samples in cURL, Python, JavaScript and Java - [API basics](https://tokenra.io/docs/common.html): base URL, authentication, errors, retries - [Quickstart](https://tokenra.io/docs/quickstart.html): create a key and send a first request - [All models](https://tokenra.io/docs/models.html): every model ID - [Chinese version of this guide](https://tokenra.io/zh/docs/gemini-4-carbon/llms.txt) - [Site index for agents](https://tokenra.io/llms.txt) --- Canonical version of this document: https://tokenra.io/docs/gemini-4-carbon/llms.txt