Qwen2.5-Coder is the latest series of Code-Specific Qwen large language models (formerly known as CodeQwen). As of now, Qwen2.5-Coder has covered six mainstream model sizes, 0.5, 1.5, 3, 7, 14, 32 billion parameters, to meet the needs of different developers. Qwen2.5-Coder brings the following improvements upon CodeQwen1.5:
Provider: All Qwen models | Cloudflare Workers AI
https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/v1/chat/completionsInstall: pip install openai
import os
from openai import OpenAI
account_id = os.environ["CLOUDFLARE_ACCOUNT_ID"]
client = OpenAI(
api_key=os.environ["CLOUDFLARE_API_TOKEN"],
base_url=f"https://api.cloudflare.com/client/v4/accounts/{account_id}/ai/v1",
)
response = client.chat.completions.create(
model="@cf/qwen/qwen2.5-coder-32b-instruct",
messages=[
{"role": "user", "content": "Hello, how are you?"},
],
max_tokens=1024,
)
print(response.choices[0].message.content)Additional examples: Basic invoke, REST API (any task)
| Parameter | Type | Description |
|---|---|---|
| max_tokens | integer | Maximum tokens to generate. (≥1) |
| temperature | float | Controls randomness. Supported range varies by model. (≥0) |
| stream | boolean | Stream response chunks as they are generated. Default: false. |
Call text generation and embedding models with OpenAI-compatible client libraries using the account-scoped Workers AI base URL.
Run any Workers AI model, including image, speech, and embedding models, through the account-scoped /ai/run endpoint.
List available models, tasks, and per-model properties with the Workers AI models search API.