Gemini API

Gemini API

Four Gemini models are available through the same passthrough as the rest of the Text API, on all four request formats.

ModelChoose it for
gemini-3.8-flashThe newest Flash generation — same price as 3.7, same 1M context
gemini-3.7-flashThe model used in the examples below — fast, cheap, and strong on reasoning for its price
gemini-3.6-flashThe previous Flash generation, for pipelines already calibrated on it
gemini-3.1-pro-previewThe hardest reasoning and the longest context work

Gemini 3.x reasons by default and charges thinking tokens as output. max_tokens bounds thinking plus the visible answer together, so a small budget returns a truncated stub: at max_tokens: 150 a typical request spent 142 tokens thinking and returned four. Budget at least 1,000 output tokens for a short answer.

POST https://api.beatapi.io/v1beta/models/{model}:generateContent

Send the BeatAPI key with x-goog-api-key, Bearer authentication, or the Gemini SDK-compatible key query parameter. Prefer the header for direct HTTP integrations.

$curl --request POST \
> --url 'https://api.beatapi.io/v1beta/models/gemini-3.7-flash:generateContent' \
> --header 'Authorization: Bearer <BEATAPI_API_KEY>' \
> --header 'Content-Type: application/json' \
> --data '{
> "contents": [
> {
> "role": "user",
> "parts": [
> {
> "text": "Design a resilient webhook retry strategy for a payments API."
> }
> ]
> }
> ]
>}'

Use :streamGenerateContent for the streamed variant. BeatAPI forwards the event stream without converting it.

Existing SDK formats

The same models answer on the other three request formats. Migrate an existing integration by changing the base URL and replacing the provider key with a BeatAPI key.

OpenAI Chat Completions

POST https://api.beatapi.io/v1/chat/completions

$curl --request POST \
> --url https://api.beatapi.io/v1/chat/completions \
> --header 'Authorization: Bearer <BEATAPI_API_KEY>' \
> --header 'Content-Type: application/json' \
> --data '{
> "model": "gemini-3.7-flash",
> "messages": [
> {
> "role": "user",
> "content": "Design a resilient webhook retry strategy for a payments API."
> }
> ]
>}'

Reasoning tokens are reported under usage.completion_tokens_details.reasoning_tokens and are included in completion_tokens.

OpenAI Responses

POST https://api.beatapi.io/v1/responses

$curl --request POST \
> --url https://api.beatapi.io/v1/responses \
> --header 'Authorization: Bearer <BEATAPI_API_KEY>' \
> --header 'Content-Type: application/json' \
> --data '{
> "model": "gemini-3.7-flash",
> "input": "Design a resilient webhook retry strategy for a payments API.",
> "reasoning": {
> "effort": "medium"
> }
>}'

Anthropic Messages

POST https://api.beatapi.io/v1/messages

$curl --request POST \
> --url https://api.beatapi.io/v1/messages \
> --header 'Authorization: Bearer <BEATAPI_API_KEY>' \
> --header 'Content-Type: application/json' \
> --data '{
> "model": "gemini-3.7-flash",
> "max_tokens": 1024,
> "messages": [
> {
> "role": "user",
> "content": "Design a resilient webhook retry strategy for a payments API."
> }
> ]
>}'

Caching

Cached input tokens are billed at one tenth of the base input rate and are reported under usage.prompt_tokens_details.cached_tokens. Google’s context-caching storage fee is not passed through — you are billed for cache reads only.

Authentication and availability

List the currently enabled text models before rollout:

$curl https://api.beatapi.io/v1/models \
> -H "Authorization: Bearer $BEATAPI_API_KEY"
1{
2 "object": "list",
3 "data": [
4 { "id": "gemini-3.7-flash", "object": "model", "owned_by": "beatapi" }
5 ]
6}

The same API key and USD balance are shared across Text, Image, Video, Workflow, Effect, and Realtime APIs. Calls are metered from actual token usage; inspect request IDs, model, token totals, status, and settled amount in Dashboard usage logs.

Production checklist

  • Budget output tokens for thinking, not just for the answer.
  • Keep API keys on trusted servers and redact them from logs.
  • Set explicit request timeouts and reconnect streamed responses safely.
  • Log the response request ID for support and billing audits.
  • Handle 401, 402, 429, 502, and 503 as distinct operational cases.

Continue with media models

The same BeatAPI account can call GPT-5.6, Claude, Nano Banana 2, and the rest of the Image and Video APIs without adding another billing or authentication system.