Skip to navigation

GPT Chat Completions

Call GPT-6.1 Sol, GPT-6 Astra, GPT-6 Sol and GPT-6 Luna through one OpenAI Chat Completions endpoint with a BeatAPI key.

  • One endpoint, POST /v1/chat/completions, for every current GPT model. Change model to switch.
  • Text and image input, text output, streaming, function calling, structured outputs and configurable reasoning effort.
  • Works with the OpenAI SDK: change the base URL and use a BeatAPI key.
  • For new reasoning and tool-calling integrations, OpenAI Responses is the recommended format.

Use https://direct.beatapi.io as the base URL for text requests: it is not subject to Cloudflare’s 100-second limit, so a long non-streaming request is not cut off. https://api.beatapi.io also works and is the fallback if direct.beatapi.io is unreachable from your network. The key, models and prices are the same on both. Image and video APIs use https://api.beatapi.io only.

POST/v1/chat/completionsTry it

Opens this endpoint in the API Explorer. Enter your BeatAPI API key and send: the call is real and is billed to your own balance.

Models

Send one of these IDs as model. Each is a separate model; do not treat them as aliases of each other.

Model IDContext (tokens)Max output (tokens)PositioningInput, USD per 1M tokensOutput, USD per 1M tokensNotes
gpt-6.1-sol1,050,000128,000GPT-6.1 Sol for coding, computer use, and professional work. Use Responses for tool calling.$0.80$4.00Reasoning effort low to max. Higher rate above 272K input tokens.
gpt-6-astra1,000,000128,000Most capable GPT model: complex reasoning, coding, computer use, research and document work$4.00$20.00Higher rate above 272K input tokens.
gpt-6-sol1,050,000128,000Mid-tier GPT-6 model for everyday coding, research, and agentic work at a lower price$0.80$4.00A separate model from GPT-6.1 Sol and GPT-5.6 Sol.
gpt-6-luna1,050,000128,000Cost-efficient GPT-6 model for focused, high-volume tasks$0.04$0.20High-volume, focused tasks such as extraction, classification and routing.
  • Prices are the base tier, discount already applied. A long-context tier, cached-input rates and cache writes are not in this table; see the price table.
  • — means the catalogue does not publish the number.

Older IDs of this family still work and are listed on Legacy models.

Quick start

Install the openai package on your server, keep the key in BEATAPI_API_KEY, and never put it in browser code. These are request examples, not recorded model outputs.

Read the answer from choices[0].message.content, then check finish_reason and usage. An HTTP 200 alone does not prove the answer satisfies your task: validate it in your application. Text requests return directly; do not poll /v1/tasks for them.

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

Endpoint and authentication

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

Authorization string Required

Bearer <BEATAPI_API_KEY>. The key works with or without the sk- prefix.

Request parameters

Standard OpenAI Chat Completions fields are accepted. Request-format compatibility does not mean every provider-specific option or tool is supported, so test the options you rely on.

model string Required

The exact model ID.

Allowed values: gpt-6.1-sol, gpt-6-astra, gpt-6-sol, gpt-6-luna

  • Older IDs that still work (gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna) are on Legacy models.
  • Call GET /v1/models with your key to confirm which models are enabled for it.

messages object[] Required

The conversation, oldest message first. Each message has a role and content. content is a string, or an array of parts for text and image input.

  • Image input is supported by all GPT models on this page.

max_tokens integer Optional

Upper bound on the generated tokens.

  • The gateway accepts values up to 1,073,741,823; a larger value is 400 bad_request.
  • The gateway does not compare your value with the model’s max output from the table above. Keep it at or below that number.
  • max_tokens is also used to estimate how much balance a request needs. A very large value can be refused with 402 insufficient_credits even when the real output would be small. Set it to what you need.

stream boolean OptionalDefault: false

Return the answer as server-sent events. See the Streaming section below.

Default: false

reasoning_effort string Optional

How much reasoning the model does before answering. Start with medium, then evaluate one level lower and higher on your own workload.

Allowed values: none, low, medium, high, xhigh, max

Per model

  • gpt-6.1-sol: low, medium, high, xhigh and max. none and minimal are not supported.
  • gpt-5.6-sol: none, low, medium, high, xhigh and max.
  • gpt-5.6-terra: none, low, medium, high, xhigh and max.
  • gpt-5.6-luna: none, low, medium, high, xhigh and max.

tools object[] Optional

Function definitions the model may call. Return the tool result in a following tool message.

response_format object Optional

Ask for structured output, for example a JSON schema.

Response

A non-streaming call returns one JSON object. This is an abbreviated example.

{
"id": "chatcmpl-example",
"object": "chat.completion",
"created": 1791993600,
"model": "gpt-6-luna",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Retry with exponential backoff and jitter, and make every handler idempotent."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 19,
"completion_tokens": 16,
"total_tokens": 35
}
}

Response fields

FieldTypeDescription
idstringThe completion ID. Log it, together with the request ID, for support and billing audits.
modelstringThe model that answered.
choices[].message.contentstringThe answer text.
choices[].finish_reasonstringstop for a complete answer. A truncated answer or a tool request needs separate handling.
usageobjectToken counts. Calls are metered from actual token usage.

Streaming

Set "stream": true. BeatAPI forwards the server-sent event stream without converting it, so event objects stay compatible with the OpenAI SDK.

  • The response is text/event-stream; without streaming it is application/json.
  • A failure before the model is called is returned as a normal JSON error with an HTTP status, not as a stream event.
  • Set explicit timeouts and reconnect a streamed response safely.
data: {"id":"chatcmpl-example","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"Retry"},"finish_reason":null}]}
data: {"id":"chatcmpl-example","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":" with backoff"},"finish_reason":null}]}
data: {"id":"chatcmpl-example","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]

Errors

Error or symptomCauseFix
400 with a reasoning effort the model does not supportFor example none on gpt-6.1-sol.Use a value the model supports; see reasoning_effort above.
402 insufficient_creditsBalance below the price of the request, often because max_tokens is very large.Top up, or lower max_tokens.
403 forbiddenThe account is on free credit and the model is not on the free list, or the model is outside the key’s group.Top up, use a free model, or use a key whose group can reach the model.
404 not_foundUnknown model ID, or not enabled for this key.List the enabled models with GET /v1/models.
429 rate_limit_exceededAccount or free-model limit reached.Wait Retry-After, then retry.

HTTP errors at a glance

Authentication, routing, rate-limit and unknown-model failures are answered before the model is called, in the BeatAPI envelope: error.code, error.message, retryable, request_id. Every other failure keeps the OpenAI SDK shape {"error": {"message", "type", "code"}}: the code is in error.code and the request id ends message. See Errors.

HTTP statusCodeWhat to do
400bad_request, content_policy_violationFix the request or the input; do not resend it unchanged.
401missing_api_key, invalid_api_keyCheck the key. Do not retry.
402insufficient_creditsTop up, or raise the key’s limit. A very large max_tokens can trigger it.
403forbiddenThe model is outside the key’s group or IP allowlist, or free credit cannot call this model.
404not_foundUnknown model: list the enabled ones with GET /v1/models.
429rate_limit_exceededWait Retry-After or retry_after_seconds, then retry with backoff.
500internal_error, temporary_errorRetry once or twice with backoff.
503model_unavailable, upstream_timeout, temporary_errorRetry with backoff, or use another model.

Full code table and retry policy: Errors.

Notes

  • GPT models also answer on OpenAI Responses.
  • Above 272K input tokens, gpt-6.1-sol and gpt-6-astra use a higher tier for the full request. See the price table before budgeting a long-context workload.
  • Keep API keys on trusted servers, log the response request ID, and retry only 429, 500 and 503.

Authentication

AuthorizationBearer

Send your API key as Authorization: Bearer <BEATAPI_API_KEY>.

Request

This endpoint expects an object.
modelenumRequired

The exact model ID.

Older IDs that still work (gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna) are on Legacy models.

Call GET /v1/models with your key to confirm which models are enabled for it.

gpt-6.1-sol, gpt-6-astra, gpt-6-sol, gpt-6-luna

Allowed values:
messageslist of objectsRequired

The conversation, oldest message first. Each message has a role and content. content is a string, or an array of parts for text and image input.

Image input is supported by all GPT models on this page.

max_tokensintegerOptional

Upper bound on the generated tokens.

The gateway accepts values up to 1,073,741,823; a larger value is 400 bad_request.

The gateway does not compare your value with the model’s max output from the table above. Keep it at or below that number.

max_tokens is also used to estimate how much balance a request needs. A very large value can be refused with 402 insufficient_credits even when the real output would be small. Set it to what you need.

streambooleanOptionalDefaults to false

Return the answer as server-sent events. See the Streaming section below.

reasoning_effortenumOptional

How much reasoning the model does before answering. Start with medium, then evaluate one level lower and higher on your own workload.

gpt-6.1-sol: low, medium, high, xhigh and max. none and minimal are not supported.

gpt-5.6-sol: none, low, medium, high, xhigh and max.

gpt-5.6-terra: none, low, medium, high, xhigh and max.

gpt-5.6-luna: none, low, medium, high, xhigh and max.

none, low, medium, high, xhigh, max

toolslist of objectsOptional

Function definitions the model may call. Return the tool result in a following tool message.

response_formatobjectOptional
Ask for structured output, for example a JSON schema.

Response

A non-streaming call returns one JSON object. This is an abbreviated example.

idstringOptional
The completion ID. Log it, together with the request ID, for support and billing audits.
modelstringOptional
The model that answered.
choiceslist of objectsOptional
usageobjectOptional
Token counts. Calls are metered from actual token usage.

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error