Qwen Messages
Call Qwen3.8 Max and Qwen3.8 Flash in the Anthropic Messages format with a BeatAPI key.
- One endpoint,
POST /v1/messages, for every current Qwen model. Changemodelto switch. - Streaming and tool use. Both models are priced flat across the whole 1,000,000-token window.
- Works with the Anthropic SDK: change the base URL and use a BeatAPI key. Send the
anthropic-versionheader with every request. tool_choiceis passed to the model, though not every model enforces it;thinkingdoes not take effect. See the parameter reference below.
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.
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.
- 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.
Quick start
Install the @anthropic-ai/sdk or anthropic package on your server, keep the key in BEATAPI_API_KEY, and never put it in browser code. The SDK sends the anthropic-version header for you. These are request examples, not recorded model outputs.
Read the answer from the text blocks of content, then check stop_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.
Endpoint and authentication
POST https://direct.beatapi.io/v1/messages
x-api-key
string
Required
Your BeatAPI key. Authorization: Bearer <BEATAPI_API_KEY> is also accepted.
Send the anthropic-version header (for example 2023-06-01) with every request; the Anthropic SDK adds it automatically. For authentication, x-api-key and Authorization: Bearer <BEATAPI_API_KEY> both work.
Request parameters
The request uses the Anthropic Messages shape. The fields below take effect; the last two are accepted by the SDK but do not change the result. A field that is not listed on this page is not guaranteed to have any effect.
model
string
Required
The exact model ID.
Allowed values: qwen3.8-max, qwen3.8-flash
- Each ID is a separate model, not an alias of another.
- Call
GET /v1/modelswith your key to confirm which models are enabled for it.
max_tokens
integer
Required
Upper bound on the generated tokens, reasoning included.
- 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_tokensis also used to estimate how much balance a request needs. A very large value can be refused with402 insufficient_creditseven when the real output would be small. Set it to what you need.
A reasoning model writes its reasoning first. If max_tokens is too small, the reasoning can use all of it: the text block is empty and stop_reason is max_tokens. Leave room for both, and raise the value when you see max_tokens.
messages
object[]
Required
The conversation, oldest message first. Each message has a role (user or assistant) and content: a string, or an array of blocks.
- Text blocks (
text), the model’s tool requests (tool_use) and your results (tool_result) take effect. - A
tool_resultblock must carry thetool_use_idof thetool_useblock it answers.
system
string | object[]
Optional
The system prompt: a string, or an array of text blocks. The text blocks are joined into one system prompt.
stream
boolean
OptionalDefault: false
Return the answer as server-sent events. See the Streaming section below.
Default: false
temperature
number
Optional
Sampling temperature. Change this or top_p, not both.
top_p
number
Optional
Nucleus sampling threshold.
stop_sequences
string[]
Optional
Sequences at which generation stops.
tools
object[]
Optional
Tool definitions the model may call. Each tool takes effect through its name, description and input_schema. The model answers with a tool_use block; return the result in a tool_result block of the next user message.
tool_choice
object
Optional
How the model may use tools. {"type": "auto"} lets it decide (the default), {"type": "any"} makes it call one of the tools, {"type": "tool", "name": "..."} makes it call that tool, and {"type": "none"} stops it from calling any. disable_parallel_tool_use: true limits it to one call per answer. Ignored when tools is absent. The setting is passed to the model, but not every model enforces it: in our tests (2026-10-15) DeepSeek ignored it and Qwen enforced any but not a named tool, so check the answer for a tool_use block rather than assuming one.
thinking
object
Optional
Does not take effect. It neither turns reasoning on nor off, and it sets no reasoning budget. A model that reasons by default keeps doing so, and its reasoning comes back as thinking blocks.
Response
A non-streaming call returns one JSON object. This is an abbreviated example.
Response fields
Streaming
Set "stream": true. The stream starts with message_start and ends with message_stop; the blocks in between arrive as content_block_start, content_block_delta and content_block_stop events, and message_delta carries the stop_reason.
- The response is
text/event-stream; without streaming it isapplication/json. - Text arrives in
text_deltaevents. A reasoning model sends athinkingblock withthinking_deltaevents before the text block. Tool arguments arrive ininput_json_deltaevents. - 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.
Errors
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 Anthropic shape {"type": "error", "error": {"type", "message"}}: the code is in error.type and the request id ends message. See Errors.
Full code table and retry policy: Errors.
Notes
- Qwen models also answer on Chat Completions and OpenAI Responses.
- Cached input is priced separately from fresh input. A repeated prompt prefix is billed at the cache rate automatically; there is no cache API to call, so check the cached-input count in
usage. - Send
anthropic-versionwith every request. Do not rely onthinking: it does not take effect. - Keep API keys on trusted servers, log the response request ID, and retry only
429,500and503.
Authentication
Send your API key as Authorization: Bearer <BEATAPI_API_KEY>.
Request
The exact model ID.
Each ID is a separate model, not an alias of another.
Call GET /v1/models with your key to confirm which models are enabled for it.
qwen3.8-max, qwen3.8-flash
Upper bound on the generated tokens, reasoning included.
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.
A reasoning model writes its reasoning first. If max_tokens is too small, the reasoning can use all of it: the text block is empty and stop_reason is max_tokens. Leave room for both, and raise the value when you see max_tokens.
The conversation, oldest message first. Each message has a role (user or assistant) and content: a string, or an array of blocks.
Text blocks (text), the model’s tool requests (tool_use) and your results (tool_result) take effect.
A tool_result block must carry the tool_use_id of the tool_use block it answers.
The system prompt: a string, or an array of text blocks. The text blocks are joined into one system prompt.
Return the answer as server-sent events. See the Streaming section below.
Sampling temperature. Change this or top_p, not both.
Tool definitions the model may call. Each tool takes effect through its name, description and input_schema. The model answers with a tool_use block; return the result in a tool_result block of the next user message.
How the model may use tools. {"type": "auto"} lets it decide (the default), {"type": "any"} makes it call one of the tools, {"type": "tool", "name": "..."} makes it call that tool, and {"type": "none"} stops it from calling any. disable_parallel_tool_use: true limits it to one call per answer. Ignored when tools is absent. The setting is passed to the model, but not every model enforces it: in our tests (2026-10-15) DeepSeek ignored it and Qwen enforced any but not a named tool, so check the answer for a tool_use block rather than assuming one.
Does not take effect. It neither turns reasoning on nor off, and it sets no reasoning budget. A model that reasons by default keeps doing so, and its reasoning comes back as thinking blocks.
Response
A non-streaming call returns one JSON object. This is an abbreviated example.
Content blocks: thinking (on models that reason, before the answer), text and tool_use.
end_turn for a complete answer, tool_use for a tool request, max_tokens when max_tokens was reached, stop_sequence when a stop sequence matched.
input_tokens and output_tokens. Reasoning counts as output. Calls are metered from actual token usage.

