Endpoints
Generate Content
POST http://127.0.0.1:8045/v1beta/models/{model}:generateContent
Stream Generate Content
POST http://127.0.0.1:8045/v1beta/models/{model}:streamGenerateContent?alt=sse
List Models
GET http://127.0.0.1:8045/v1beta/models
Get Model Info
GET http://127.0.0.1:8045/v1beta/models/{model}
Count Tokens
POST http://127.0.0.1:8045/v1beta/models/{model}:countTokens
The Gemini native protocol endpoint provides direct compatibility with Google AI SDKs and supports advanced features like thinking signatures, grounding, and tool calling.
Authentication
Bearer token authentication Authorization: Bearer sk-antigravity
Alternatively, use query parameter:
API key as query parameter
Path Parameters
Model name:
gemini-3-flash - Fast and efficient
gemini-3-pro-high - High quality reasoning
gemini-3-pro-low - Cost-efficient
gemini-3-pro-image - Image generation
claude-sonnet-4-6 - Mapped Claude model
Request Body
Conversation content in Gemini format Message role: user or model
Message parts (text, images, function calls) Cryptographic signature for thought validation
Embedded media data MIME type, e.g., image/jpeg, audio/mp3
Function/tool call Function arguments as JSON object
Function execution result
Generation parameters Maximum output tokens (automatically capped to model limits)
Sampling temperature (0.0 to 2.0)
Nucleus sampling (0.0 to 1.0)
Stop sequences for generation
Extended thinking configuration Token budget for reasoning (e.g., 8192, 16384, 24576)
Thinking level: NONE, LOW, MEDIUM, HIGH
(Auto-converted to budget internally)
Available tools/functions Function declarations JSON Schema for parameters
Enable Google Search grounding (automatic web search)
System-level instruction Instruction parts (same structure as content parts)
Project ID (automatically injected by proxy)
Non-Streaming Response
Generated candidates Generated content Response parts (text, function calls, thinking)
Completion reason: STOP, MAX_TOKENS, SAFETY, RECITATION
Search grounding results Web sources with titles and URIs
Token usage statistics Cached tokens (context caching)
Actual model version used
Example: Basic Generation
curl -X POST "http://127.0.0.1:8045/v1beta/models/gemini-3-flash:generateContent" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-antigravity" \
-d '{
"contents": [
{
"role": "user",
"parts": [{"text": "Explain how AI works"}]
}
]
}'
Example: Streaming
curl -X POST "http://127.0.0.1:8045/v1beta/models/gemini-3-pro-high:streamGenerateContent?alt=sse" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-antigravity" \
-d '{
"contents": [
{
"role": "user",
"parts": [{"text": "Write a story about space exploration"}]
}
],
"generationConfig": {
"temperature": 0.8,
"maxOutputTokens": 2048
}
}'
Example: With System Instruction
curl -X POST "http://127.0.0.1:8045/v1beta/models/gemini-3-flash:generateContent" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-antigravity" \
-d '{
"systemInstruction": {
"parts": [{"text": "You are a helpful coding tutor. Always provide examples."}]
},
"contents": [
{
"role": "user",
"parts": [{"text": "How do I sort a list in Python?"}]
}
]
}'
Example: Function Calling
curl -X POST "http://127.0.0.1:8045/v1beta/models/gemini-3-flash:generateContent" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-antigravity" \
-d '{
"contents": [
{
"role": "user",
"parts": [{"text": "What is the weather in Paris?"}]
}
],
"tools": [
{
"functionDeclarations": [
{
"name": "get_weather",
"description": "Get current weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string"}
},
"required": ["city"]
}
}
]
}
]
}'
Example: Google Search Grounding
curl -X POST "http://127.0.0.1:8045/v1beta/models/gemini-3-pro-high:generateContent" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-antigravity" \
-d '{
"contents": [
{
"role": "user",
"parts": [{"text": "What are the latest developments in quantum computing?"}]
}
],
"tools": [
{"googleSearch": {}}
]
}'
Example: Multi-Modal (Image)
curl -X POST "http://127.0.0.1:8045/v1beta/models/gemini-3-flash:generateContent" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-antigravity" \
-d '{
"contents": [
{
"role": "user",
"parts": [
{"text": "Describe this image:"},
{
"inlineData": {
"mimeType": "image/jpeg",
"data": "base64-encoded-image-data"
}
}
]
}
]
}'
Example: Extended Thinking
curl -X POST "http://127.0.0.1:8045/v1beta/models/gemini-3-pro-high:generateContent" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-antigravity" \
-d '{
"contents": [
{
"role": "user",
"parts": [{"text": "Solve this complex math problem step by step: ..."}]
}
],
"generationConfig": {
"thinkingConfig": {
"thinkingBudget": 16384
}
}
}'
Get detailed model specs:
curl "http://127.0.0.1:8045/v1beta/models/gemini-3-pro-high" \
-H "Authorization: Bearer sk-antigravity"
Response includes:
maxOutputTokens - Maximum output limit
supportsThinking - Extended thinking support
supportedGenerationMethods - Available methods
inputTokenLimit - Context window size
Token Counting
curl -X POST "http://127.0.0.1:8045/v1beta/models/gemini-3-flash:countTokens" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-antigravity" \
-d '{
"contents": [
{
"role": "user",
"parts": [{"text": "Count tokens in this message"}]
}
]
}'
Response:
Features
Native Gemini Protocol : Full compatibility with Google AI SDK
Auto Project Injection : Automatically injects project ID from account pool
Dynamic Token Limits : Automatically caps maxOutputTokens to model limits
Thinking Signatures : Validates and preserves thinking signatures across turns
MCP Fuzzy Matching : Intelligent tool name matching for MCP servers
Grounding Support : Google Search integration for factual queries
Context Caching : Automatic caching for repeated contexts
{
"error" : {
"code" : 400 ,
"message" : "Invalid model name" ,
"status" : "INVALID_ARGUMENT"
}
}
Common error codes:
400 - Invalid request
401 - Authentication failed
429 - Quota exceeded (triggers auto-retry)
500 - Internal error