llm-api-adapter-qwen
Official Model Studio Frankfurt/Global support for Qwen in llm-api-adapter. The package uses the Anthropic-compatible Messages API directly.
Installation
Install through the Core package extra:
pip install "llm-api-adapter[qwen]"
Direct installation is also supported when Core is managed separately:
pip install llm-api-adapter-qwen
Async requests need HTTPX:
pip install "llm-api-adapter[qwen,async]"
Synchronous requests use requests by default. To opt into HTTPX for sync
chat() and stream_chat(), install "llm-api-adapter[qwen,httpx]" and pass
transport="httpx".
Quick start
import os
from llm_api_adapter.models.messages.chat_message import UserMessage
from llm_api_adapter.universal_adapter import UniversalLLMAPIAdapter
adapter = UniversalLLMAPIAdapter(
organization="qwen",
model="qwen3.8-max",
api_key=os.environ["QWEN_API_KEY"],
)
response = adapter.chat(
messages=[UserMessage("Explain retrieval-augmented generation.")],
max_tokens=128,
workspace_id=os.environ["QWEN_WORKSPACE_ID"],
)
print(response.content)
Qwen 0.1.0 supports only Model Studio's Frankfurt Global deployment. Pass the
required workspace_id explicitly to every chat, stream_chat, achat,
and astream_chat call; it is never read from an environment variable. The
package uses:
https://{workspace_id}.eu-central-1.maas.aliyuncs.com/apps/anthropic/v1/messages
Supported models and capabilities
The package deliberately exposes fixed model IDs, not moving aliases:
qwen3.8-max, qwen3.8-flash, qwen3.7-plus, and qwen3.7-flash.
| Capability | Supported models |
|---|---|
| Text chat, sync/async streaming, application function tools, JSON Schema/Pydantic output, and image URLs or bytes | All four models |
reasoning_level |
Qwen 3.8: categorical effort; Qwen 3.7: numeric thinking budget |
All four models default to hybrid thinking. Set reasoning_level="none" to
disable thinking, or capture_reasoning=True to receive provider-emitted
reasoning separately from visible text. max_tokens must be a positive integer
and limits generated output; it is separate from Qwen 3.7's thinking budget.
With thinking enabled, Model Studio's reported usage.output_tokens can also
include thinking tokens, so it can exceed max_tokens even when the visible
answer respects that output limit.
Cost fields use Frankfurt Global standard USD text rates. They exclude cached, batch, promotional, and negotiated pricing.
Qwen permits tool_choice="auto" and "none" in thinking mode, but not a
forced "any" or named tool. For a forced tool call, the adapter automatically
disables thinking and issues a UserWarning; pass reasoning_level="none" to
make that choice explicit without a warning.
PDF input
Qwen 0.1.0 supports images, but not PDFs. DocumentPart URLs and bytes are
rejected before any HTTP request:
Qwen does not support DocumentPart; PDF and OCR are unavailable in Qwen 0.1.0.
The package does not make a partial PDF/OCR request or upload document bytes.
See the main llm-api-adapter README for the shared API contract and examples.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llm_api_adapter_qwen-0.1.0.tar.gz.
File metadata
- Download URL: llm_api_adapter_qwen-0.1.0.tar.gz
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ef5252002d198f035a4c23eaf6cf61040200135bfb41ed7faaa8a1ee6a17f5e
|
|
| MD5 |
afe95b6060951415f331968d94b5f4d3
|
|
| BLAKE2b-256 |
ff5ae3dcb76441bfce96a41f5594b201ae2b746dac59346f6faf944ab5b0a73b
|
File details
Details for the file llm_api_adapter_qwen-0.1.0-py3-none-any.whl.
File metadata
- Download URL: llm_api_adapter_qwen-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12a580fcb9a7f06aad610aabcf638d85015e7dcf2ccaae586cd15c0e1c82ea3b
|
|
| MD5 |
9ad1b0ecd3dd57df2c79a4e80d5f7dbd
|
|
| BLAKE2b-256 |
6cc3d872916f3979bf472a0287dd09596b16660f27b7008407f27d4748e7428c
|