OpenAI-compatible chat completion (Qwen)

Sync OpenAI-compatible chat completion proxied to DashScope.

Set stream=true for SSE; the response preserves OpenAI’s exact wire framing so openai.OpenAI(base_url=".../v2/inference") clients work unchanged. Meters one vision/inference event per non-error response with token counts as properties.

Authentication

X-Api-Keystring

API key authentication via X-Api-Key header

OR
AuthorizationBearer
Bearer token authentication via Authorization header

Request

This endpoint expects an object.
modelstringRequired

Allow-listed Qwen model id.

messageslist of maps from strings to anyRequired
OpenAI chat messages array.
streambooleanOptionalDefaults to false

Response

Successful Response