Skip to main content
Models

Batch Chat API

Send single non-real-time chat requests at a lower price through an OpenAI-compatible endpoint

Batch Chat is a lower-cost way to run non-real-time workloads such as data annotation and content generation. It uses the same OpenAI-compatible request format as real-time chat, so you only change the base URL. Each request is submitted individually, queued, and returned over the same connection when processing finishes. Supported regions: China North 2 (Beijing). Batch Chat uses the batch host https://batch.dashscope.aliyuncs.com and an API key created in that region. See Regions and endpoints.

How it works

  1. Submit a request: the client sends a request and keeps the connection open.
  2. Queue and wait: the request waits in a queue while the connection stays open.
  3. Return the result: the server returns the complete response over the open connection. If the maximum wait time is exceeded, the connection closes with a timeout error.

Supported models

CategoryModels
Text generationqwen3.8-max, qwen3.8-flash, qwen3.7-max, qwen3.7-plus, qwen3.7-flash, qwen3.6-plus, qwen3.6-flash, qwen3.5-plus, qwen3.5-flash, qwen-max, qwen-plus, qwen-flash
Visionqwen3-vl-plus
Omni-modalqwen3.5-omni-plus, qwen3.5-omni-flash
Some models enable thinking mode by default. Thinking tokens are billed at the output token price. Set enable_thinking explicitly to control cost.

Make a call

Change the base URL from the real-time endpoint to the Batch Chat endpoint. The request body is the same as OpenAI-compatible chat.
  • Python
  • Node.js
  • curl
import os
from openai import OpenAI

client = OpenAI(
  api_key=os.getenv("DASHSCOPE_API_KEY"),
  # China North 2 (Beijing). Batch Chat is available in this region.
  # API keys are region-specific. See https://docs.qwencloud.com/developer-guides/getting-started/regions
  base_url="https://batch.dashscope.aliyuncs.com/compatible-mode/v1",
  timeout=3600,
)

completion = client.chat.completions.create(
  model="qwen-plus",
  messages=[{"role": "user", "content": "Summarize the key points of this report: ..."}],
)

print(completion.choices[0].message.content)

Limits

ItemLimit
Maximum synchronous wait3,600 seconds (1 hour)
Custom timeout60 to 3,600 seconds
Pending requests10,000 per model per account. New requests are rejected while the limit is reached.
Call rate1,000 QPS per account, or 10,000 calls per 10 seconds
The call rate is a theoretical maximum. Actual capacity depends on system load, so implement retries.

Billing

  • Only successful requests are billed, based on input and output tokens.
  • The list price matches the real-time API. A limited-time 50% discount is available.
  • Timed-out and failed requests are not billed.
  • Batch Chat does not support context caching.

Choose between Batch Chat and Batch

Batch ChatBatch (file input)
InputOne request per callOne JSONL file with up to 50,000 requests
ResultReturned over the same connectionRetrieved asynchronously after the job completes
Use this whenMany independent requests, high concurrencyOne large file, results collected later
See Batch File for file-based batch.

FAQ

Is Batch Chat slower than the real-time API? Yes. Requests are queued, so end-to-end time is usually longer. The maximum wait is one hour; if it is exceeded, the connection closes with a timeout error. Does Batch Chat guarantee that every request completes? No. Completion depends on available capacity. Requests may wait in the queue, and a request that cannot run within the maximum wait time times out. Timed-out requests are not billed; retry them later. Can I set a shorter timeout? Yes. Set a client-side timeout between 60 and 3,600 seconds.

Error codes

If a call fails and returns an error message, see Error codes.
Batch Chat API - QwenCloud