Skip to main content

Endpoint

The OpenAI-compatible endpoint provides seamless integration with 99% of existing AI applications, allowing you to use Gemini and Claude models through the standard OpenAI format.

Authentication

string
required
Bearer token authentication
Alternatively, use the api_key header:
string
API key for authentication

Request Headers

string
required
Must be application/json

Request Body

string
required
Model identifier. Supports:
  • gemini-3-flash - Fast responses
  • gemini-3-pro-high - High quality reasoning
  • gemini-3-pro-low - Cost-efficient
  • claude-sonnet-4-6 - Latest Claude Sonnet
  • claude-sonnet-4-6-thinking - With extended thinking
  • Custom model mappings from your configuration
array
required
Array of message objects forming the conversation
boolean
default:"false"
Enable streaming responses via Server-Sent Events (SSE)
integer
Maximum tokens to generate in the response
number
Sampling temperature (0.0 to 2.0). Higher values make output more random.
number
Nucleus sampling parameter (0.0 to 1.0)
array
Available tools for function calling
string | object
Controls tool usage: auto, none, or specific tool selection
object
Extended thinking configuration for compatible models

Response Format

Non-Streaming Response

string
Unique identifier for this completion
string
Object type, always chat.completion
integer
Unix timestamp of creation
string
Model used for generation
array
Array of completion choices
object
Token usage statistics

Example: Basic Chat

Example: With Streaming

Example: Python SDK

Example: Multi-Modal (Image)

Model Routing

Antigravity Manager automatically routes models to the appropriate backend:
  • Gemini models → Google AI API via internal v1 protocol
  • Claude models → Anthropic API via model mapping
  • Custom mappings → Configure in Model Router settings

Features

  • Auto-conversion: Non-stream requests automatically converted to streaming for better quota management
  • Session affinity: Maintains account consistency for multi-turn conversations
  • Smart retry: Automatic account rotation on failures (429, 401 errors)
  • Tool calling: Full support for function calling with automatic MCP integration
  • Multi-modal: Supports images, audio, and documents in messages

Error Responses

Errors follow OpenAI format:
Common HTTP status codes:
  • 400 - Invalid request format
  • 401 - Authentication failed
  • 429 - Rate limit exceeded (triggers auto-retry)
  • 503 - No available accounts