Qwen uses the same gd-… key and shared Guard balance. Seven models are available for generation; their exact IDs, input, context, and prices are listed below.
Get a key from @subscribe_ai_bot, then choose HTTP, the Python SDK, or the Node.js SDK. One shared key is issued; no separate Qwen account is required.
- Save the key in
GUARD_API_KEY; do not commit it or print it to logs. - Choose Messages, Chat Completions, or Responses. Each is available under shared
/v1and family/qwen/v1paths. - Send an exact
modeland an output budget of 4096. Use a regular JSON response for the first request. - Check the text, terminal state, and
usage; then enablestream: trueif needed.
export GUARD_API_KEY="gd-your-key"
curl https://api.guardrelay.ai/qwen/v1/messages \
-H "Authorization: Bearer $GUARD_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"qwen3.7-plus","max_tokens":4096,"messages":[{"role":"user","content":"Reply with OK"}]}'$env:GUARD_API_KEY = "gd-your-key"
$headers = @{
Authorization = "Bearer $env:GUARD_API_KEY"
"anthropic-version" = "2023-06-01"
}
$body = @{
model = "qwen3.7-plus"
max_tokens = 4096
messages = @(@{ role = "user"; content = "Reply with OK" })
} | ConvertTo-Json -Depth 10
Invoke-RestMethod -Method Post `
-Uri "https://api.guardrelay.ai/qwen/v1/messages" `
-Headers $headers `
-ContentType "application/json" `
-Body $body| API | Shared path | Qwen path | Output budget |
|---|---|---|---|
| Messages | POST /v1/messages | POST /qwen/v1/messages | max_tokens |
| Chat Completions | POST /v1/chat/completions | POST /qwen/v1/chat/completions | max_tokens / max_completion_tokens |
| Responses | POST /v1/responses | POST /qwen/v1/responses | max_output_tokens |
Both namespaces expose the same Qwen contract and billing. The family URL is convenient for a dedicated client profile and accepts only Qwen models; the shared URL is convenient when an application already selects the family through model.
| Model ID | Input | Context | Output limit |
|---|---|---|---|
qwen3.8-max | Text and images | 1,000,000 | 131,072 |
qwen3.7-max | Text only | 1,000,000 | 131,072 |
qwen3.7-plus | Text and images | 1,000,000 | 65,536 |
qwen3.6-plus | Text and images | 1,000,000 | 65,536 |
qwen3.5-plus | Text and images | 1,000,000 | 65,536 |
qwen3.5-omni-plus | Text and images | 262,144, input up to 196,608 | 65,536 |
qwen3.8-omni-flash | Text and images | 1,000,000 | 131,072 |
| API | JSON terminal | SSE terminal | Usage |
|---|---|---|---|
| Messages | stop_reason: end_turn, max_tokens, tool_use | message_delta → message_stop | input_tokens, output_tokens |
| Chat Completions | choices[].finish_reason: stop, length, tool_calls | final chunk + [DONE] | prompt_tokens, completion_tokens, total_tokens |
| Responses | status: completed, incomplete | response.completed | input_tokens, output_tokens, total_tokens |
| Model | Request input, tokens | Input / 1M | Output / 1M |
|---|---|---|---|
qwen3.8-max | up to 1,000,000 | $2.00 | $6.00 |
qwen3.7-max | up to 1,000,000 | $2.50 | $7.50 |
qwen3.7-plus | up to 256,000 | $0.40 | $1.60 |
qwen3.7-plus | above 256,000 | $1.20 | $4.80 |
qwen3.6-plus | up to 256,000 | $0.50 | $3.00 |
qwen3.6-plus | above 256,000 | $2.00 | $6.00 |
qwen3.5-plus | up to 256,000 | $0.40 | $2.40 |
qwen3.5-plus | above 256,000 | $0.50 | $3.00 |
qwen3.5-omni-plus | up to 196,608 | $1.40 | $8.30 |
qwen3.8-omni-flash | up to 1,000,000 | $0.15 | $0.47 |
Rates equal Alibaba Cloud's official rates for these models, with multiplier 1, including PRIVATE. The Plus models have two tiers: if request input exceeds 256,000 tokens, the whole request, both input and output, uses the second row. If the model searched the web at least once, the request costs $0.01 more; the number of searches does not change the price. Qwen has no cache.
For qwen3.7-plus, 10,000 input and 2,000 output tokens cost 10000×0.40/1M + 2000×1.60/1M = $0.00720000; if the model searched the web, $0.01720000 for any number of searches. At 300,000 input and 2,000 output tokens, the second tier applies: 300000×1.20/1M + 2000×4.80/1M = $0.36960000.
curl https://api.guardrelay.ai/qwen/v1/messages/count_tokens \
-H "Authorization: Bearer $GUARD_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"qwen3.7-plus","messages":[{"role":"user","content":"Count this input"}]}'The gateway counts locally, without calling the model and without a charge. It returns the same input estimate that generation billing uses, plus the X-Guard-Usage-Source: estimated header.
- One Qwen account serves one client session and runs one request at a time. Parallel requests in one session wait for each other.
- A new session of the same key, for example after
/clear, gets the account as soon as the account finishes the current request. Requests from other keys wait for a free account. - If no account is free, a request waits in the queue for up to 30 seconds and then receives
429 queue_timeoutwithRetry-After: 30. - Generating one answer takes at most 10 minutes; longer generation fails with
generation_timeout. - After 10 minutes without requests, the account is released. The next message continues the conversation from the history the client sends.
If the requested model is busy at the provider or its limit is exhausted, the nearest free Qwen model that accepts the request answers instead. The fallback happens before the first character of the answer. The client sees the requested model in the response and pays its rate. If no suitable model is free, the response is 429 provider_at_capacity with Retry-After: 5; if Qwen is temporarily unavailable, 503 qwen_unavailable with Retry-After: 30.
In the dashboard, Qwen can be paused and given its own hourly and daily spending limits for the key. A pause returns 403 api_key_paused; a reached limit returns 429 customer_hour_limit or 429 customer_day_limit.
Client functions and web search are separate mechanisms. Your application executes a function and returns its result to the model. Qwen runs web search itself when it decides search is needed; there is no separate parameter to enable or forbid it. If the model searched at least once, Guard adds $0.01 to the request once, however many searches it made.
| API | Client function declaration |
|---|---|
| Chat Completions | {type: "function", function: {name, description, parameters}} |
| Messages | {name, description, input_schema} |
| Responses | {type: "function", name, description, parameters} |
input and the incomplete terminal.Qwen errorsCodes, queue, retries, and client actions.Python SDKShort examples for the OpenAI and Anthropic SDKs.Node.js SDKChat Completions and Responses without hidden retries.