Authorizations
API key authentication. Get an API key from the QwenCloud console.
Body
application/jsonThe name of the model. See Qwen-OCR for a list of supported models.
A sequence of messages that provides context to the model in conversational order.
Specifies whether to return the response in streaming mode. false: returns the complete response at once. true: returns data blocks as the model generates them.
Configuration settings for streaming output. Applies only when stream is true.
The maximum number of tokens to generate in the output. If the generated content exceeds this value, the response is truncated.
- For qwen3.5-ocr, qwen-vl-ocr-2025-11-20, and qwen-vl-ocr-2024-10-28, the default and maximum values are the same as the model's maximum output length.
Specifies whether to return the log probabilities of the output tokens.
Specifies the number of most likely tokens to return at each generation step. Value range: [0, 5]. Takes effect only when logprobs is true.
The sampling temperature controls the diversity of the generated text. Higher = more diverse, lower = more deterministic. Value range: [0, 2). Only set one of temperature or top_p.
Probability threshold for nucleus sampling. Higher = more diverse, lower = more deterministic. Value range: (0, 1.0]. Only set one of temperature or top_p.
Size of the candidate set for sampling. A larger value increases randomness. If None or greater than 100, only top_p takes effect. Must be >= 0. Non-standard OpenAI parameter — in Python SDK use extra_body={"top_k": xxx}.
Penalty for repeated sequences. Higher values reduce repetition. 1.0 means no penalty.
Controls content repetition. Range: [-2.0, 2.0]. Positive reduces repetition, negative increases it.
A random number seed for reproducible results. Value range: [0, 2^31−1].
Stop words. When a specified string or token_id appears, generation stops immediately. Can be a string or array. If stop is an array, you cannot mix token_ids and strings as elements.