Skip to main content

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

Authorization
string
required
Bearer token authentication
Authorization: Bearer sk-antigravity
Alternatively, use query parameter:
key
string
API key as query parameter
?key=sk-antigravity

Path Parameters

model
string
required
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 Headers

Content-Type
string
required
Must be application/json

Request Body

contents
array
required
Conversation content in Gemini format
generationConfig
object
Generation parameters
tools
array
Available tools/functions
systemInstruction
object
System-level instruction
project
string
Project ID (automatically injected by proxy)

Response Format

Non-Streaming Response

candidates
array
Generated candidates
usageMetadata
object
Token usage statistics
modelVersion
string
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
      }
    }
  }'

Model Information

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:
{
  "totalTokens": 8
}

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 Format

{
  "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

Build docs developers (and LLMs) love