Grok API

Grok API

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

ModelChoose it for
grok-4.6The current flagship — the default for reasoning and tool use
grok-4.5The previous generation, for pipelines already calibrated on it

Both reason by default and report the thinking budget under usage.completion_tokens_details.reasoning_tokens, which is included in completion_tokens and billed as output.

OpenAI Chat Completions

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

1import OpenAI from "openai";
2
3const client = new OpenAI({
4 apiKey: process.env.BEATAPI_API_KEY,
5 baseURL: "https://api.beatapi.io/v1"
6});
7
8const completion = await client.chat.completions.create({
9 model: "grok-4.6",
10 max_tokens: 2000,
11 messages: [
12 { role: "user", content: "Design a resilient webhook retry strategy for a payments API." }
13 ]
14});
15
16console.log(completion.choices[0].message.content);
$curl --request POST \
> --url https://api.beatapi.io/v1/chat/completions \
> --header 'Authorization: Bearer <BEATAPI_API_KEY>' \
> --header 'Content-Type: application/json' \
> --data '{
> "model": "grok-4.6",
> "messages": [
> {
> "role": "user",
> "content": "Design a resilient webhook retry strategy for a payments API."
> }
> ]
>}'

Long context pricing

Grok switches to a higher rate once the prompt reaches 200,000 tokens, and the higher rate then applies to every token in that request — input, cached input, and output all double. Below the threshold the standard rate applies to the whole request.

This threshold is 200K, not the 272K used by the GPT-5.6 family. A prompt sized against the wrong one bills at double the expected rate.

Other SDK formats

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": "grok-4.6",
> "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": "grok-4.6",
> "max_tokens": 1024,
> "messages": [
> {
> "role": "user",
> "content": "Design a resilient webhook retry strategy for a payments API."
> }
> ]
>}'

Gemini-compatible content

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

$curl --request POST \
> --url 'https://api.beatapi.io/v1beta/models/grok-4.6: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."
> }
> ]
> }
> ]
>}'

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": "grok-4.6", "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 reasoning, not just for the answer.
  • Watch the 200K prompt threshold — crossing it doubles the whole request.
  • Keep API keys on trusted servers and redact them from logs.
  • 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, Gemini, and the Image and Video APIs without adding another billing or authentication system.