Skip to main content
The Google-native protocol. Speaks the Gemini generateContent REST contract verbatim, so the google-generativeai Python SDK and the @google/generative-ai JS SDK work unchanged — flip the base URL and your apiKey. Cross-vendor models (Claude, GPT, DeepSeek, Doubao) are translated to Gemini shape under the hood.

When to use

Pick this endpoint when you want:
  • Drop-in for google-generativeai / Gemini SDK clients
  • Gemini-only features like responseSchema with the Gemini-flavoured JSON schema, or safetySettings
  • Code paths already structured around contents[].parts[] (different from OpenAI / Anthropic messages)
For the same model via the Anthropic shape, use /v1/messages; for OpenAI shape, /chat/completions.

Request

The {model} in the path is the model slug (e.g. gemini-3-5-flash). For streaming, use the sibling :streamGenerateContent path — see Streaming below.

Headers

Body

Response

Response fields

Accounting headers

Same envelope as every other endpoint:
Full breakdown in the API Reference overview.

Streaming

Use the sibling path :streamGenerateContent:
Response is SSE (alt=sse) with each frame carrying a partial candidates payload:
(Without alt=sse, the response is a JSON array of frames — the SDK default.)

Tool calling

Gemini’s tools[].functionDeclarations[] shape. Round-trip via two requests:

Round 1 — tool offered

Response includes a functionCall part:
Note args is a structured object here, not a JSON string (unlike OpenAI’s tool_calls.arguments).

Round 2 — tool result returned

Multimodal (image / audio parts)

Inline a base64-encoded image as a part on the user message:
For files stored externally, use fileData.fileUri (the file must be publicly reachable over HTTPS). Audio (audio/wav, audio/mp3) and video (video/mp4) parts work the same way on multimodal-capable models.

Cross-model routing

The {model} path segment accepts any ByteSpike catalog model — the gateway translates the Gemini shape to each model’s native protocol:
Caveats:
  • responseSchema constraint requires the model to support structured outputs; otherwise returns 400 unsupported_feature.
  • safetySettings are only honored on Gemini models — silently ignored on Claude / GPT / DeepSeek (those have their own safety stacks).
  • usageMetadata field names are Gemini-shape regardless of the model.
Full catalog: GET /v1/models. Pricing per model: bytespike.ai/pricing.

Errors

All non-2xx responses are free. Body shape matches Gemini’s error envelope:

SDK example

google-generativeai Python SDK, base URL pointed at ByteSpike: