Gemini 4 Carbon
Request ID gemini-4-carbon
Protocols
POST /v1beta/models/gemini-4-carbon:generateContent· Gemini generateContent examplePOST /v1beta/models/gemini-4-carbon:streamGenerateContent· Gemini streamGenerateContent example
Authentication
Requests require an API key from API key management. For JSON requests, set Content-Type: application/json.
- Gemini ·
x-goog-api-key: YOUR_API_KEY
Request parameters
POST /v1beta/models/gemini-4-carbon:generateContent
| Field | Type | Required | Description |
|---|---|---|---|
model (path) | string | Required | Use gemini-4-carbon as the model ID in the URL path. |
contents | object[] | Required | Conversation contents in order. Each item holds its input parts in parts. |
contents[].role | string | Optional | Message role. Use user for user input and model for model messages in history. |
contents[].parts | object[] | Required | Array of parts within a content item. Text parts use text. |
contents[].parts[].inlineData | object | Conditional | Inline media object. Provide mimeType and Base64-encoded data. Accepted media types depend on the model and endpoint. |
systemInstruction | object | Optional | System instruction object. Put instruction text in parts[].text. |
generationConfig.maxOutputTokens | integer | Optional | Caps output tokens. The accepted limit depends on the model and endpoint. |
generationConfig.responseMimeType | string | Optional | Output MIME type. Use application/json for JSON output. |
generationConfig.responseJsonSchema | object | Conditional | Output JSON Schema. Use with responseMimeType: application/json on an endpoint that supports schemas. |
tools | object[] | Conditional | Tool definitions available to the model. Tool types and parameter formats depend on the protocol and endpoint. |
POST /v1beta/models/gemini-4-carbon:streamGenerateContent
| Field | Type | Required | Description |
|---|---|---|---|
model (path) | string | Required | Use gemini-4-carbon as the model ID in the URL path. |
contents | object[] | Required | Conversation contents in order. Each item holds its input parts in parts. |
contents[].role | string | Optional | Message role. Use user for user input and model for model messages in history. |
contents[].parts | object[] | Required | Array of parts within a content item. Text parts use text. |
contents[].parts[].inlineData | object | Conditional | Inline media object. Provide mimeType and Base64-encoded data. Accepted media types depend on the model and endpoint. |
systemInstruction | object | Optional | System instruction object. Put instruction text in parts[].text. |
generationConfig.maxOutputTokens | integer | Optional | Caps output tokens. The accepted limit depends on the model and endpoint. |
generationConfig.responseMimeType | string | Optional | Output MIME type. Use application/json for JSON output. |
generationConfig.responseJsonSchema | object | Conditional | Output JSON Schema. Use with responseMimeType: application/json on an endpoint that supports schemas. |
tools | object[] | Conditional | Tool definitions available to the model. Tool types and parameter formats depend on the protocol and endpoint. |
?alt | string | Optional | Query parameter. Set to sse to receive the streamGenerateContent result as SSE. |
Request examples
Set your API key in the local ICODEEASY_API_KEY environment variable and choose an endpoint that accepts direct HTTP calls. For endpoints that require a specific client, follow that client’s setup guide.
Gemini generateContent
curl -sS 'https://api.icodeeasy.cc/v1beta/models/gemini-4-carbon:generateContent' \
-H "x-goog-api-key: $ICODEEASY_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Explain how a rainbow forms in one sentence."
}
]
}
]
}'
Gemini streamGenerateContent
curl -N -sS 'https://api.icodeeasy.cc/v1beta/models/gemini-4-carbon:streamGenerateContent?alt=sse' \
-H "x-goog-api-key: $ICODEEASY_API_KEY" \
-H 'Content-Type: application/json' \
--data '{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Explain how a rainbow forms in one sentence."
}
]
}
]
}'
Read the response
- Gemini generateContent · Read text parts in
candidates[].content.parts[]. JSON - Gemini streamGenerateContent · Parse each SSE record and append the text in
candidates[].content.parts[]. SSE
Capabilities and limits
streaming· Supportedtool_calling· Conditional — Depends on the compatible protocol and request formatimage_input· Conditional — Depends on the compatible endpoint and request formatvideo_input· Conditional — Depends on the compatible endpoint and request format
Model Capability Catalog · View pricing
Related guides
Gemini CLI Setup
Install Gemini CLI, configure authentication and the custom service domain, then use strict non-streaming JSON, SSE responses, and the video analysis demo correctly.
Gemini generateContent
Send native Gemini requests and read JSON responses or SSE streams. Put the model ID in the URL path and text in contents[].parts[].
Model Capability Catalog
Compare public text, image, and video models by normalized request ID, compatible protocols, supported clients, tool use, media capabilities, limits, and review date.