Developer Dashboard

Alibaba Models (Qwen)

AvalAI provides comprehensive access to Alibaba's complete Qwen model family through their official DashScope cloud infrastructure. These models offer cutting-edge capabilities across text generation, multimodal processing, reasoning, machine translation, and coding tasks, all accessible via our unified API endpoints.

Important: enable_thinking Parameter

⚠️ Note for Non-Streaming Requests: Most Alibaba Qwen models require you to explicitly set extra_body parameter {"enable_thinking": False} when making non-streaming requests (stream=False). Without this parameter, DashScope may return an error.

Key Requirements:

  • Non-streaming requests: Must include extra_body={"enable_thinking": False}
  • Streaming requests with thinking: Can use extra_body={"enable_thinking": True} only with stream=True
  • Error if violated: Setting enable_thinking: True without streaming will result in an invalid_request error

Example for non-streaming requests:

python
response = client.chat.completions.create(
    model="qwen3-8b",
    messages=[{"role": "user", "content": "Your question here"}],
    stream=False,
    extra_body={"enable_thinking": False},  # Required for non-streaming
)
Responses API version This version uses `gpt-5.5` because `qwen3-8b` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Your question here",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Example for streaming requests with thinking:

python
stream = client.chat.completions.create(
    model="qwen3-8b",
    messages=[{"role": "user", "content": "Your question here"}],
    stream=True,
    extra_body={"enable_thinking": True},  # Only supported with streaming
)
Responses API version This version uses `gpt-5.5` because `qwen3-8b` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Your question here",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Available Models

Alibaba's Qwen models are organized into several specialized families, each optimized for different use cases and performance requirements. All models support v1/chat/completions; support for v1/messages and v1/responses is model-specific. The new qwen3.8-max flagship supports v1/chat/completions and v1/messages fully, with partial v1/responses support.

Qwen Flash Series

High-performance models optimized for speed and efficiency, ideal for applications requiring fast response times with excellent quality.

⚠️ Deprecation Notice: The legacy qwen-turbo series (qwen-turbo, qwen-turbo-latest, qwen-turbo-2025-04-28) is being decommissioned by Alibaba between May 13, 2026 and May 31, 2026. Please migrate to qwen-flash or qwen3.6-flash. See Deprecations for details.

Featureqwen-flashqwen-flash-2025-07-28
ProviderDashScopeDashScope
OwnerAlibabaAlibaba
Context Window131,072 tokens131,072 tokens
Max Input Tokens129,024129,024
Max Output Tokens16,38416,384
StrengthsUltra-fast, Tiered pricingStable flash version
Best forCost-effective speedProduction flash
python
# Example using Qwen Flash for fast text generation
response = client.chat.completions.create(
    model="qwen3.6-flash",
    messages=[
        {
            "role": "user",
            "content": "Summarize the key benefits of renewable energy in 3 bullet points.",
        }
    ],
    max_tokens=200,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)
Responses API version This version uses `gpt-5.5` because `qwen3.6-flash` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Summarize the key benefits of renewable energy in 3 bullet points.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Qwen3.8 Series

qwen3.8-max

qwen3.8-max is Alibaba's new 2.4-trillion-parameter mixture-of-experts flagship for long-horizon coding, professional work, multimodal understanding, and agentic execution. It can plan, implement, and verify multi-stage work across extended conversations, including projects that span more than 10 days.

FeatureDetails
Model IDqwen3.8-max
Context window1,000,000 tokens (up to 991,000 input tokens)
Maximum output128,000 tokens
Input pricing$2.00 / 1M tokens
Cache creation$2.50 / 1M tokens
Cached input pricing$0.25 / 1M tokens
Output pricing$6.00 / 1M tokens
Input modalitiesText, image, video
Output modalitiesText
Supported endpointsv1/chat/completions (full), v1/messages (full), v1/responses (partial)

Key Features:

  • Long-Horizon Coding: Plans, implements, tests, and verifies substantial multi-stage software projects
  • Professional Work: Produces end-to-end deliverables across legal, financial, design, and other specialist domains
  • Native Visual Understanding: Uses images and extended video throughout planning, execution, and verification
  • Ultra-Long Document Analysis: Handles large repositories and extensive document collections within a 1M-token context window
  • Agentic Feedback Loops: Iterates through planning, tool use, execution, and verification for complex tasks
  • Developer Features: Function calling, tool choice, structured output, prompt caching, web search, and streaming
  • Hybrid Thinking: Use enable_thinking for deeper reasoning; follow the streaming requirements documented at the top of this page
python
from openai import OpenAI

client = OpenAI(
    api_key="your-avalai-api-key",
    base_url="https://api.avalai.ir/v1",
)

response = client.chat.completions.create(
    model="qwen3.8-max",
    messages=[
        {
            "role": "user",
            "content": "Review this architecture and propose a staged implementation plan with verification gates.",
        }
    ],
    extra_body={"enable_thinking": False},
)

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

For launch details, see the August 3, 2026 update.


Qwen3.7 Series

Alibaba's previous proprietary Qwen generation is designed for the agent era. Use qwen3.8-max for Alibaba's current highest-capability long-horizon work, qwen3.7-max for the previous Max generation, and qwen3.7-plus for a lower-cost option that still supports large-context coding, reasoning, and multimodal workflows.

qwen3.7-max

The previous Qwen Max flagship built for agentic workflows. It provides frontier coding capabilities, strong reasoning, and sustained autonomous execution across hundreds or thousands of tool calls; use qwen3.8-max for the latest flagship generation.

Pricing note: The table below reflects the current model metadata exposed through AvalAI. Use GET /v1/models/qwen3.7-max to confirm live pricing before quoting it in customer-facing workflows.

FeatureDetails
Model IDqwen3.7-max
Context window1,000,000 tokens
Maximum output65,536 tokens
Input pricing$2.50 / 1M tokens
Cache creation$3.125 / 1M tokens
Cached input pricing$0.25 / 1M tokens (90% cost reduction)
Output pricing$7.50 / 1M tokens
Input modalitiesText, Image, Video
Output modalitiesText
Supported endpointsv1/chat/completions, v1/responses (partial)

Key Features:

  • Agent Foundation: Built for the agent era — coding, office productivity, and long-horizon execution
  • Frontier Coding Agent: 80.4 on SWE-Verified, 60.6 on SWE-Pro, 78.3 on SWE-Multilingual, 69.7 on Terminal-Bench 2.0
  • Strong Reasoning: 92.4 on GPQA Diamond, 97.1 on HMMT 2026 Feb, 90.0 on IMOAnswerBench, 44.5 on Apex
  • Agent Benchmarks: 60.8 on MCP-Mark, 76.4 on MCP-Atlas, 87.0 on SpreadSheetBench-v1, 75.0 on BFCL-V4
  • Long-Horizon Execution: Demonstrated 35-hour autonomous kernel optimization with 1,158 tool calls and 10.0x speedup
  • Cross-Harness Generalization: Consistent performance across Claude Code, OpenClaw, Qwen Code, and custom frameworks
  • Hybrid Thinking: Optional reasoning mode via enable_thinking (streaming only)
  • Preserve Thinking: Recommended for multi-turn agent workflows via preserve_thinking

Benchmark Performance:

  • SWE-Verified: 80.4 (on par with Opus-4.6 Max at 80.8)
  • SWE-Pro: 60.6 (vs. K2.6 at 59.5)
  • SWE-Multilingual: 78.3 (vs. Opus-4.6 at 77.5)
  • Terminal-Bench 2.0: 69.7 (vs. DS-V4-Pro Max at 67.9)
  • NL2Repo: 47.2
  • HMMT 2026 Feb: 97.1 (best in class)
  • GPQA Diamond: 92.4 (best in class)
  • IMOAnswerBench: 90.0 (best in class)
  • MMLU-Pro: 89.6
  • MRCR-v2 128k: 90.4 (best in class)
  • WMT24++: 85.8 (best in class)
python
# Example using Qwen3.7-Max for long-horizon agentic tasks
stream = client.chat.completions.create(
    model="qwen3.7-max",
    messages=[
        {
            "role": "user",
            "content": "Build a multi-file Python CLI that downloads, validates, and merges CSV files from S3.",
        }
    ],
    stream=True,
    extra_body={
        "enable_thinking": True,
        "preserve_thinking": True,
    },
)
Responses API version This version uses `gpt-5.5` because `qwen3.7-max` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Build a multi-file Python CLI that downloads, validates, and merges CSV files from S3.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

qwen3.7-plus

The balanced Qwen3.7 model for high-quality general chat, agentic coding, multimodal reasoning, and long-context production workloads when qwen3.7-max is more capability than the task requires.

FeatureDetails
Model IDqwen3.7-plus
Context windowUp to 1,000,000 tokens
Maximum output65,536 tokens
Input pricing$0.40 / 1M tokens
Cache creation$0.50 / 1M tokens
Cached input pricing$0.04 / 1M tokens
Output pricing$1.60 / 1M tokens
Input modalitiesText, Image, Video
Output modalitiesText
Supported endpointsv1/chat/completions

Best for:

  • General-purpose Qwen3.7 workloads with lower cost than qwen3.7-max
  • Coding agents, document-heavy prompts, and multimodal analysis
  • High-volume applications that still need large context and tool-aware behavior
python
# Example using Qwen3.7-Plus for balanced agentic coding
response = client.chat.completions.create(
    model="qwen3.7-plus",
    messages=[
        {
            "role": "user",
            "content": "Review this architecture plan and identify the highest-risk migration steps.",
        }
    ],
    extra_body={"enable_thinking": False},
)
Responses API version This version uses `gpt-5.5` because `qwen3.7-plus` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Review this architecture plan and identify the highest-risk migration steps.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Qwen3.6 Plus Series

Alibaba's flagship Qwen3.6 model with massive capability upgrades, featuring a 1M context window by default, significantly improved agentic coding capabilities, and better multimodal perception and reasoning.

qwen3.6-plus

A high-capability Qwen3.6 model with enhanced agentic coding and multimodal capabilities.

FeatureDetails
Model IDqwen3.6-plus
Context window1,000,000 tokens (default)
Input pricing$0.50 / 1M tokens
Input pricing (above 256K)$2.00 / 1M tokens
Cache creation$0.625 / 1M tokens
Cache creation (above 256K)$2.50 / 1M tokens
Cached input pricing$0.05 / 1M tokens (90% cost reduction)
Cached input (above 256K)$0.20 / 1M tokens
Output pricing$3.00 / 1M tokens
Output pricing (above 256K)$6.00 / 1M tokens
Input modalitiesText, Image
Output modalitiesText
Supported endpointsv1/chat/completions

Key Features:

  • 1M Context Window: Default million-token context for extensive documents and conversations
  • SOTA Agentic Coding: From frontend web development to complex repository-level problem solving
  • Enhanced Multimodal: Greater accuracy and sharper multimodal reasoning
  • Coding Agent Excellence: 78.8% on SWE-bench Verified, 61.6% on Terminal-Bench 2.0
  • Deep Planning: 41.5% on DeepPlanning benchmark (leading performance)
  • MCP Support: 48.2% on MCPMark for Model Context Protocol integration
  • Tool Decathlon: Strong performance across diverse tool-use scenarios

Benchmark Performance:

  • SWE-bench Verified: 78.8%
  • SWE-bench Multilingual: 73.8%
  • SWE-bench Pro: 56.6%
  • Terminal-Bench 2.0: 61.6%
  • TAU3-Bench: 70.7%
  • DeepPlanning: 41.5%
  • MCPMark: 48.2%
  • MMLU-Pro: 88.5%
  • SuperGPQA: 71.6%
python
# Example using Qwen3.6-Plus for agentic coding
response = client.chat.completions.create(
    model="qwen3.6-plus",
    messages=[
        {
            "role": "user",
            "content": "Analyze this codebase and implement a fix for the bug in the authentication module.",
        }
    ],
    max_tokens=4000,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)
Responses API version This version uses `gpt-5.5` because `qwen3.6-plus` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Analyze this codebase and implement a fix for the bug in the authentication module.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Qwen3.6 Series (Flash, 27B, 35B-A3B, Max-Preview)

Four new models from the Qwen3.6 series with significant improvements in agentic coding, STEM reasoning, spatial intelligence, and object detection over the Qwen3.5 generation. The flash/27B/35B-A3B variants are native vision-language models; the max-preview is the largest and most capable text-only variant.

qwen3.6-flash

The Qwen3.6 native vision-language Flash model with a 1M context window and significantly improved agentic coding, mathematical reasoning, and spatial intelligence over qwen3.5-flash.

FeatureDetails
Model IDqwen3.6-flash
Context window1,000,000 tokens (256K tier-one pricing)
Maximum output64K tokens
Input pricing$0.25 / 1M tokens
Input pricing (above 256K)$1.00 / 1M tokens
Cache creation$0.3125 / 1M tokens
Cache creation (above 256K)$1.25 / 1M tokens
Cached input pricing$0.025 / 1M tokens (90% cost reduction)
Cached input (above 256K)$0.10 / 1M tokens
Output pricing$1.50 / 1M tokens
Output pricing (above 128K)$4.00 / 1M tokens
Input modalitiesText, Image, Video
Output modalitiesText
Supported endpointsv1/chat/completions

Key Features:

  • Native Vision-Language: Processes text, images, and videos natively
  • 1M Context Window: Extended context for long documents and conversations
  • Agentic Coding: Substantially outperforms Qwen3.5-Flash on code-agent benchmarks
  • Spatial Intelligence: Markedly improved object localization and detection
  • Deep Thinking: Optional reasoning mode via enable_thinking
  • Tool Support: Function calling, structured output, and web search
python
response = client.chat.completions.create(
    model="qwen3.6-flash",
    messages=[
        {
            "role": "user",
            "content": "Implement a binary search tree in Python with insert, delete, and in-order traversal methods.",
        }
    ],
    extra_body={"enable_thinking": True},
)
Responses API version This version uses `gpt-5.5` because `qwen3.6-flash` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Implement a binary search tree in Python with insert, delete, and in-order traversal methods.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

qwen3.6-27b

The Qwen3.6 27B native vision-language dense model with key improvements in agentic coding, STEM reasoning, and visual agent capabilities.

FeatureDetails
Model IDqwen3.6-27b
Context window256,000 tokens
Maximum output64K tokens
Input pricing$0.60 / 1M tokens
Cached input pricing$0.06 / 1M tokens (90% cost reduction)
Output pricing$3.60 / 1M tokens
Input modalitiesText, Image, Video
Output modalitiesText
Supported endpointsv1/chat/completions

Key Features:

  • Native Vision-Language: Processes text, images, and videos natively
  • 256K Context Window: Extended context for complex tasks
  • Enhanced STEM Reasoning: Improved mathematical and code reasoning skills
  • Visual Agents: Advances in video understanding, document OCR, and visual agent capabilities
  • Deep Thinking: Optional reasoning mode via enable_thinking
python
response = client.chat.completions.create(
    model="qwen3.6-27b",
    messages=[
        {
            "role": "user",
            "content": "Analyze this diagram and extract the workflow steps.",
        }
    ],
    max_tokens=4096,
)
Responses API version This version uses `gpt-5.5` because `qwen3.6-27b` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Analyze this diagram and extract the workflow steps.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

qwen3.6-35b-a3b

The Qwen3.6 35B-A3B native vision-language model with a hybrid architecture integrating linear attention and sparse mixture-of-experts for higher inference efficiency.

FeatureDetails
Model IDqwen3.6-35b-a3b
Context window256,000 tokens
Maximum output64K tokens
Input pricing$0.248 / 1M tokens
Cached input pricing$0.025 / 1M tokens (90% cost reduction)
Output pricing$1.485 / 1M tokens
Input modalitiesText, Image, Video
Output modalitiesText
Supported endpointsv1/chat/completions

Key Features:

  • Hybrid Architecture: Linear attention combined with sparse MoE for higher efficiency
  • Improved Agentic Coding: Significantly better code-agent performance
  • Spatial Intelligence: Advances in object localization and detection
  • Cost-Effective: Very low pricing thanks to efficient sparse activation
  • Deep Thinking: Optional reasoning mode via enable_thinking
python
response = client.chat.completions.create(
    model="qwen3.6-35b-a3b",
    messages=[
        {
            "role": "user",
            "content": "Refactor this monolithic service into microservices.",
        }
    ],
    max_tokens=4096,
)
Responses API version This version uses `gpt-5.5` because `qwen3.6-35b-a3b` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Refactor this monolithic service into microservices.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

qwen3.6-max-preview

The largest and most capable variant in the Qwen3.6 series, available in preview with text-only capabilities. Features enhanced vibe coding, efficient coding agent execution, and upgraded long-tail knowledge retention.

FeatureDetails
Model IDqwen3.6-max-preview
Context window256,000 tokens (128K tier-one pricing)
Maximum output64K tokens
Input pricing$1.30 / 1M tokens
Input pricing (above 128K)$2.00 / 1M tokens
Cache creation$1.625 / 1M tokens
Cache creation (above 128K)$2.50 / 1M tokens
Cached input pricing$0.13 / 1M tokens (90% cost reduction)
Cached input (above 128K)$0.20 / 1M tokens
Output pricing$7.80 / 1M tokens
Output pricing (above 128K)$12.00 / 1M tokens
Input modalitiesText
Output modalitiesText
Supported endpointsv1/chat/completions

Key Features:

  • Largest Qwen3.6 Model: Most capable variant in the Qwen3.6 series
  • Enhanced Vibe Coding: Stronger front-end development and coding agent execution
  • Long-Tail Knowledge: Upgraded knowledge retention for specialized topics
  • 256K Context Window: Extended context for complex tasks
  • Deep Thinking: Optional reasoning mode via enable_thinking
python
response = client.chat.completions.create(
    model="qwen3.6-max-preview",
    messages=[
        {
            "role": "user",
            "content": "Build a polished Next.js landing page for a SaaS product with hero, features, testimonials, and pricing sections.",
        }
    ],
    max_tokens=8192,
)
Responses API version This version uses `gpt-5.5` because `qwen3.6-max-preview` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Build a polished Next.js landing page for a SaaS product with hero, features, testimonials, and pricing sections.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Qwen Plus Series

Balanced models offering excellent performance across diverse tasks, providing the optimal combination of capability and efficiency.

Featureqwen-plusqwen-plus-latestqwen-plus-2025-09-11qwen-plus-2025-07-28qwen-plus-2025-07-14qwen-plus-2025-04-28
ProviderDashScopeDashScopeDashScopeDashScopeDashScopeDashScope
OwnerAlibabaAlibabaAlibabaAlibabaAlibabaAlibaba
Context Window131,072 tokens131,072 tokens131,072 tokens131,072 tokens131,072 tokens131,072 tokens
Max Input Tokens129,024129,024129,024129,024129,024129,024
Max Output Tokens16,38416,38416,38416,38416,38416,384
StrengthsBalanced PerformanceLatest FeaturesEnhanced ReasoningPrevious StableStable ReleaseLegacy Version
Best forGeneral-purpose tasksCutting-edge featuresAdvanced analysisProduction useStable productionLegacy compatibility
python
# Example using Qwen Plus for general-purpose tasks
response = client.chat.completions.create(
    model="qwen-plus",
    messages=[
        {
            "role": "user",
            "content": "Explain the concept of machine learning to a beginner.",
        }
    ],
    max_tokens=500,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)
Responses API version This version uses `gpt-5.5` because `qwen-plus` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Explain the concept of machine learning to a beginner.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Qwen3 Max Series

Premium models designed for the most demanding applications, offering superior reasoning and complex problem-solving capabilities.

New: The flagship qwen3-max model is now available for complex reasoning and agentic workflows. See the June 5, 2026 update for details.

⚠️ Deprecation Notice: The legacy qwen-max series (qwen-max, qwen-max-latest, qwen-max-2025-01-25) is being decommissioned by Alibaba between May 13, 2026 and May 31, 2026. Please migrate to qwen3.7-max, qwen3-max, qwen3.6-plus, or qwen3.6-max-preview. See Deprecations for details.

Featureqwen3-maxqwen3-max-2026-01-23qwen3-max-preview
ProviderDashScopeDashScopeDashScope
OwnerAlibabaAlibabaAlibaba
Context Window262,144 tokens262,144 tokens262,144 tokens
Max Input Tokens258,048258,048258,048
Max Output Tokens32,76832,76832,768
StrengthsEnhanced Agent ProgrammingLatest Snapshot1T+ Parameters
Best forAgent programming, Complex scenariosProduction stabilityMost demanding tasks
python
# Example using Qwen3-Max for enhanced agent programming tasks
response = client.chat.completions.create(
    model="qwen3-max",
    messages=[
        {
            "role": "user",
            "content": "Design an intelligent agent system that can autonomously manage complex multi-step workflows with tool invocation capabilities.",
        }
    ],
    max_tokens=2000,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)

# Example using Qwen3-Max-Preview for the most demanding tasks
response = client.chat.completions.create(
    model="qwen3-max-preview",
    messages=[
        {
            "role": "user",
            "content": "Perform a comprehensive analysis of quantum computing's potential impact on cryptography and data security.",
        }
    ],
    max_tokens=2000,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)
Responses API version This version uses `gpt-5.5` because `qwen3-max` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Perform a comprehensive analysis of quantum computing",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Qwen 3.5 Series

Next-generation native vision-language models built on a hybrid architecture that integrates linear attention mechanisms with sparse mixture-of-experts, achieving higher inference efficiency with state-of-the-art performance.

Featureqwen3.5-plusqwen3.5-plus-2026-02-15qwen3.5-flashqwen3.5-397b-a17bqwen3.5-35b-a3b
ProviderDashScopeDashScopeDashScopeDashScopeDashScope
OwnerAlibabaAlibabaAlibabaAlibabaAlibaba
ParametersHostedHostedHosted397B total, 17B activated35B total, 3B activated
Context Window1,000,000 tokens1,000,000 tokens1,000,000 tokens131,072 tokens131,072 tokens
Max Output Tokens32,76832,76816,38416,38416,384
Input ModalitiesText, Image, VideoText, Image, VideoText, Image, VideoText, Image, VideoText, Image, Video
Strengths1M context, built-in toolsStable version1M context, high efficiencyOpen-weight, strong agentsOpen-weight, lightweight MoE
Best forLong context, multimodal agentsProduction deploymentsCost-effective long contextOpen-source deploymentsEdge deployment, efficient inference

Key Features:

  • Hybrid Architecture: Integrates linear attention (via Gated Delta Networks) with sparse mixture-of-experts for higher inference efficiency
  • Native Vision-Language: Process text, images, and videos natively
  • 1M Context Window: Extended context for qwen3.5-plus and qwen3.5-flash via Alibaba Cloud Model Studio
  • 201 Languages: Expanded language and dialect support from 119 to 201 languages
  • Built-in Tools: Official adaptive tool use support for agentic workflows
  • Deep Thinking: Advanced reasoning capabilities on par with leading frontier models
  • Open-Weight Models: qwen3.5-397b-a17b and qwen3.5-35b-a3b are open-source under Apache 2.0

Pricing:

ModelInputInput >256KCache CreationCache Creation >256KCached InputCached Input >256KOutputOutput >256K
qwen3.5-plus$0.40/1M$1.20/1M$0.50/1M$1.50/1M$0.04/1M$0.12/1M$2.40/1M$7.20/1M
qwen3.5-flash$0.10/1M$0.30/1M$0.125/1M$0.375/1M$0.01/1M$0.03/1M$0.40/1M$1.20/1M
qwen3.5-397b-a17b$0.60/1M---$0.06/1M-$3.60/1M-
qwen3.5-35b-a3b$0.25/1M---$0.12/1M-$2.00/1M-
python
# Example using Qwen3.5 Plus for multimodal agent tasks
response = client.chat.completions.create(
    model="qwen3.5-plus",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Analyze this image and describe the key elements.",
                },
                {
                    "type": "image_url",
                    "image_url": {"url": "https://example.com/image.png"},
                },
            ],
        }
    ],
    max_tokens=2000,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)

# Example using Qwen3.5-397B for complex reasoning tasks
response = client.chat.completions.create(
    model="qwen3.5-397b-a17b",
    messages=[
        {
            "role": "user",
            "content": "Design a comprehensive software architecture for a distributed microservices system.",
        }
    ],
    max_tokens=4000,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)

# Example using Qwen3.5-Flash for cost-effective long context processing
response = client.chat.completions.create(
    model="qwen3.5-flash",
    messages=[
        {
            "role": "user",
            "content": "Summarize the key points from this lengthy document...",
        }
    ],
    max_tokens=2000,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)

# Example using Qwen3.5-35B-A3B for efficient open-weight inference
response = client.chat.completions.create(
    model="qwen3.5-35b-a3b",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Describe what you see in this image."},
                {
                    "type": "image_url",
                    "image_url": {"url": "https://example.com/image.jpg"},
                },
            ],
        }
    ],
    max_tokens=1000,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)
Responses API version This version uses `gpt-5.5` because `qwen3.5-plus` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    input=[
        {
            "role": "user",
            "content": [
                {
                    "type": "input_text",
                    "text": "Summarize the key points from this lengthy document...",
                },
                {"type": "input_image", "image_url": "https://example.com/image.png"},
            ],
        }
    ],
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

The qwen3-max model supports real-time web search capabilities, allowing it to retrieve up-to-date information from the internet to answer questions about current events, stock prices, weather, and other real-time data that may not be in the model's training data.

Note

As of December 2025, only qwen3-max and qwen3-max-2025-09-23 models support the web search feature. The search strategy must be set to agent for international (Singapore) regions.

How It Works

When you enable web search by passing enable_search: true, the model will:

  1. Analyze if the user's question requires real-time information
  2. If needed, perform a web search and use the results to generate a response
  3. If not needed, use its own knowledge to answer

Usage Example

bash
curl -X POST https://api.avalai.ir/v1/chat/completions \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3-max",
    "messages": [
        {
            "role": "user",
            "content": "What is Alibaba stock price"
        }
    ],
    "enable_search": true,
    "search_options": {"search_strategy": "agent"}
}'
python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

response = client.chat.completions.create(
    model="qwen3-max",
    messages=[
        {
            "role": "user",
            "content": "What is the weather forecast for tomorrow in New York?",
        }
    ],
    extra_body={"enable_search": True, "search_options": {"search_strategy": "agent"}},
)

print(response.choices[0].message.content)
javascript
import { OpenAI } from "openai";

const client = new OpenAI({
  apiKey: process.env.AVALAI_API_KEY,
  baseURL: "https://api.avalai.ir/v1",
});

const response = await client.chat.completions.create({
  model: "qwen3-max",
  messages: [
    { role: "user", content: "What are the latest tech news today?" }
  ],
  enable_search: true,
  search_options: { search_strategy: "agent" }
});

console.log(response.choices[0].message.content);
Responses API version This version uses `gpt-5.5` because `qwen3-max` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="What are the latest tech news today?",
)

print(response.output_text)
javascript
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AVALAI_API_KEY,
  baseURL: "https://api.avalai.ir/v1",
});

const response = await client.responses.create({
  model: "gpt-5.5",
  instructions: "You are a helpful assistant.",
  input: "What are the latest tech news today?",
});

console.log(response.output_text);
bash
curl https://api.avalai.ir/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -d '
  {
    "model": "gpt-5.5",
    "input": "What are the latest tech news today?",
    "instructions": "You are a helpful assistant."
  }'
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Parameters

ParameterTypeDescription
enable_searchbooleanSet to true to enable web search. The model decides if a search is needed.
search_options.search_strategystringMust be set to "agent" for international regions.

Use Cases

  • Real-time stock prices: Get current market data and stock information
  • Weather forecasts: Retrieve up-to-date weather predictions for any location
  • Current events: Answer questions about recent news and happenings
  • Sports scores: Get live or recent game results
  • Product information: Find current prices and availability

Billing

Web search involves two cost components:

  1. Model call fees: Web search results are added to the prompt, increasing input tokens. Standard model pricing applies.
  2. Search policy fees: For the agent strategy in international regions, the fee is $10.00 per 1,000 calls.

Vision-Language Models

Multimodal models capable of understanding and processing both text and visual inputs, enabling sophisticated image analysis and description tasks.

Qwen3 VL Series

Next-generation vision-language models with enhanced capabilities for understanding images, videos, and text.

ModelContext WindowMax InputMax OutputBest for
qwen3-vl-32b-instruct131,072129,0248,192Open-source balanced VL tasks
qwen3-vl-plus131,072+129,024+8,192Long context, video, agent tasks
qwen3-vl-flash131,072+129,024+8,192Fast, cost-effective VL tasks

Key Features:

  • Long Document Support: Process documents with millions of tokens
  • Long Video Understanding: Analyze videos up to 1 hour in length
  • OCR Capabilities: Advanced text extraction from images
  • Agent Capabilities: Image retrieval and tool use
  • Tiered Pricing: Cost optimization based on context length
python
# Example using Qwen3-VL-Plus for vision-language tasks
response = client.chat.completions.create(
    model="qwen3-vl-plus",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "Analyze this document and extract key information.",
                },
                {
                    "type": "image_url",
                    "image_url": {"url": "https://example.com/document.png"},
                },
            ],
        }
    ],
    extra_body={"enable_thinking": False},
)
Responses API version This version uses `gpt-5.5` because `qwen3-vl-plus` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    input=[
        {
            "role": "user",
            "content": [
                {"type": "input_text", "text": "Describe this image."},
                {"type": "input_image", "image_url": "https://example.com/image.png"},
            ],
        }
    ],
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Qwen 2.5 VL Series

ModelContext WindowMax InputMax OutputBest for
qwen2.5-vl-72b-instruct131,072129,0248,192Complex vision tasks
qwen2.5-vl-32b-instruct131,072129,0248,192Balanced vision processing
qwen2.5-vl-7b-instruct131,072129,0248,192Efficient vision tasks
qwen2.5-vl-3b-instruct131,072129,0248,192Lightweight vision

Qwen VL OCR

⚠️ Deprecation Notice: The legacy qwen-vl-max and qwen-vl-plus series (including -latest and dated snapshots) are being decommissioned by Alibaba between May 13, 2026 and May 31, 2026. Please migrate to the Qwen3 VL series (e.g., qwen3-vl-plus, qwen3-vl-flash) or Qwen 3.5 VL models. See Deprecations for details.

ModelContext WindowMax InputMax OutputSpecialization
qwen-vl-ocr34,09630,0004,096Optical character recognition
python
# Example using Qwen VL for image analysis
response = client.chat.completions.create(
    model="qwen2.5-vl-72b-instruct",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "text",
                    "text": "What objects do you see in this image and their approximate locations?",
                },
                {
                    "type": "image_url",
                    "image_url": {
                        "url": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png"
                    },
                },
            ],
        }
    ],
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)
Responses API version This version uses `gpt-5.5` because `qwen2.5-vl-72b-instruct` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    input=[
        {
            "role": "user",
            "content": [
                {"type": "input_text", "text": "Describe this image."},
                {"type": "input_image", "image_url": "https://example.com/image.png"},
            ],
        }
    ],
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Qwen 3 Series

Next-generation models with enhanced capabilities and improved performance across various tasks.

Standard Qwen 3 Models

ModelContext WindowMax InputMax OutputParameters
qwen3-32b131,07298,30416,38432B
qwen3-14b131,07298,3048,19214B
qwen3-8b131,07298,3048,1928B
qwen3-4b131,07298,3048,1924B
qwen3-1.7b131,07298,3048,1921.7B
qwen3-0.6b131,07298,3048,1920.6B

Qwen 3 A3B Series

ModelContext WindowMax InputMax OutputSpecialization
qwen3-next-80b-a3b-thinking131,07298,30432,768Advanced reasoning with thinking
qwen3-next-80b-a3b-instruct131,07298,30432,768Enhanced instruction following
qwen3-30b-a3b131,07298,30432,768Advanced reasoning
qwen3-30b-a3b-thinking-2507131,07298,30432,768Thinking processes
qwen3-30b-a3b-instruct-2507131,07298,30432,768Instruction following

Qwen 3 A22B Series

ModelContext WindowMax InputMax OutputSpecialization
qwen3-235b-a22b131,072131,07232,768Large-scale reasoning
qwen3-235b-a22b-instruct-2507131,072131,07232,768Advanced instructions
qwen3-235b-a22b-thinking-2507131,072131,07232,768Complex thinking

Specialized Models

QWQ Plus Series (Reasoning Models)

ModelContext WindowMax InputMax OutputFocus
qwq-plus131,072131,0728,192Advanced reasoning
qwq-plus-2025-03-05131,072131,0728,192Stable reasoning

Machine Translation Models

Professional translation models supporting 92 languages with high-quality bidirectional translation.

ModelContext WindowMax InputMax OutputSpecialization
qwen-mt-plus2,0482,0482,048Advanced translation
qwen-mt-turbo2,0482,0482,048Fast translation
qwen-mt-flash8,1928,1928,192High-quality translation
qwen-mt-lite8,1928,1928,192Fast, cost-effective

Key Features:

  • 92 Languages: Support for major world languages including European, Asian, and Middle Eastern
  • Bidirectional: Translate between any pair of supported languages
  • Direct Translation: Translate between non-Chinese languages without intermediate Chinese
  • Persian/Farsi Support: Full support for Persian, Dari, Arabic, Urdu, Turkish, and more

Supported Languages Include: Arabic, Chinese (Simplified/Traditional), Dutch, English, French, German, Italian, Japanese, Korean, Persian, Portuguese, Russian, Spanish, Turkish, Vietnamese, and 77 more languages.

python
# Example using Qwen-MT for translation
response = client.chat.completions.create(
    model="qwen-mt-flash",
    messages=[
        {"role": "system", "content": "Translate from English to Persian"},
        {
            "role": "user",
            "content": "Artificial intelligence is transforming the way we live and work.",
        },
    ],
    extra_body={"enable_thinking": False},
)
# Output: هوش مصنوعی در حال تغییر نحوه زندگی و کار ما است.
Responses API version This version uses `gpt-5.5` because `qwen-mt-flash` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Artificial intelligence is transforming the way we live and work.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Character/Role-Playing Models

Specialized models for creating consistent virtual character interactions with personality preservation.

ModelContext WindowMax InputMax OutputSpecialization
qwen-plus-character131,072129,02416,384Virtual characters, role-playing

Key Features:

  • Character Consistency: Maintain defined personalities, traits, and speech styles across conversations
  • Response Variety: Avoid repetitive responses with style markers
  • Relationship Memory: Preserve interaction history and relationship dynamics
  • Genre Flexibility: Support for fantasy, sci-fi, romance, and modern scenarios
python
# Example using Qwen-Plus-Character for virtual characters
response = client.chat.completions.create(
    model="qwen-plus-character",
    messages=[
        {
            "role": "system",
            "content": "You are a wise wizard named Merlin from a fantasy world. Speak with ancient wisdom and occasional riddles.",
        },
        {"role": "user", "content": "Merlin, how do I become a great sorcerer?"},
    ],
    extra_body={"enable_thinking": False},
)
Responses API version This version uses `gpt-5.5` because `qwen-plus-character` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Merlin, how do I become a great sorcerer?",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Long Context Models

ModelContext WindowMax InputMax OutputSpecialization
qwen2.5-7b-instruct-1m1,008,1921,000,0008,192Million-token context
qwen2.5-14b-instruct-1m1,008,1921,000,0008,192Extended context

Coding Models

ModelContext WindowMax InputMax OutputSpecialization
qwen3-coder-480b-a35b-instruct262,144204,80065,536Advanced coding
qwen3-coder-next1,000,000997,95265,536Frontier coding agents (80B MoE)
qwen3-coder-flash1,000,000997,95265,536Fast coding with tiered pricing
qwen3-coder-flash-2025-07-281,000,000997,95265,536Stable fast coding
qwen3-coder-plus1,000,000997,95265,536Code generation
qwen3-coder-plus-2025-07-221,000,000997,95265,536Latest coding

Qwen3-Coder-Next

Qwen3-Coder-Next is a frontier 80B MoE (Mixture of Experts) model optimized for coding agents, featuring 10B activated parameters for efficient inference.

Key Features:

  • 80B MoE Architecture: Large-scale mixture of experts with 10B activated parameters
  • 1M Context Window: Extended context for large codebase understanding
  • Agentic Optimization: Designed for autonomous coding workflows
  • High Efficiency: Optimized inference with sparse activation

Pricing:

ModelInputCached InputOutput
qwen3-coder-next$0.30/1M$0.15/1M$1.50/1M
python
# Example using Qwen3-Coder-Next for agentic coding tasks
response = client.chat.completions.create(
    model="qwen3-coder-next",
    messages=[
        {
            "role": "user",
            "content": "Analyze this codebase and refactor the authentication module to use JWT tokens with refresh token rotation.",
        }
    ],
    max_tokens=8000,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)

# Example using Qwen Coder for programming tasks
response = client.chat.completions.create(
    model="qwen3-coder-plus",
    messages=[
        {
            "role": "user",
            "content": "Write a Python function to implement a binary search algorithm with proper error handling.",
        }
    ],
    max_tokens=1000,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)
Responses API version This version uses `gpt-5.5` because `qwen3-coder-next` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Write a Python function to implement a binary search algorithm with proper error handling.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Image Generation Models

Advanced image generation and editing models with dual SDK support, compatible with both OpenAI schema and native Alibaba Dashscope schema.

ModelSpecializationCost per ImageResolution OptionsBest for
qwen-image-2.0-proProfessional typography$0.075Native 2K (2048×2048)PPTs, posters, infographics
qwen-image-2.0Unified generation/editing$0.035Native 2K (2048×2048)General image generation
qwen-imageText-to-image generation$0.0351:1, 4:3, 3:4, 16:9, 9:16Creative image generation
qwen-image-editImage editing and modification$0.045Based on input imageImage enhancement and editing
z-image-turboFast text-to-image$0.015 (std) / $0.030 (thinking)512×512 to 2048×2048Fast generation, text rendering
qwen-image-edit-plusAdvanced image editing$0.03Based on input imageProfessional editing, style transfer

qwen-image-2.0-pro

Alibaba's next-generation professional image generation model with advanced typography rendering, supporting 1K-token instructions for direct generation of professional infographics including PPTs, posters, and comics.

FeatureDetails
Model IDqwen-image-2.0-pro
ResolutionNative 2K (2048×2048)
Input pricing$0.00 / request
Output pricing$75.00 / 1M tokens ($0.075 / image)
Input modalitiesText, Image
Output modalitiesImage
Supported endpoints/v1/images/generations, /v1/images/edits

Key Features:

  • Professional Typography: 1K-token instruction support for PPTs, posters, and infographics
  • Complex Layout: Pixel-perfect multi-script layout with sophisticated text-image composition
  • Native 2K Resolution: 2048×2048 for finely detailed realistic scenes
  • Unified Model: Generation and editing in a single model
  • Photorealism: Microscopic detail on skin pores, fabric weave, architectural textures
  • Multiple Calligraphic Styles: Support for various script styles and fonts
  • Image Editing: Full support for image-to-image editing tasks
python
# Generate professional infographic with Qwen-Image-2.0-Pro
response = client.images.generate(
    model="qwen-image-2.0-pro",
    prompt="A professional business presentation slide showing Q4 revenue growth with clean typography and modern design",
    size="1024x1024",
    n=1,
)
print(response.data[0].url)

qwen-image-2.0

The standard version of Qwen-Image-2.0, offering the same advanced capabilities at a more accessible price point.

FeatureDetails
Model IDqwen-image-2.0
ResolutionNative 2K (2048×2048)
Input pricing$0.00 / request
Output pricing$35.00 / 1M tokens ($0.035 / image)
Input modalitiesText, Image
Output modalitiesImage
Supported endpoints/v1/images/generations, /v1/images/edits

Key Features:

  • Typography Rendering: Support for professional text-in-image generation
  • Native 2K Resolution: High-quality image output
  • Unified Model: Generation and editing capabilities combined
  • Strong Semantic Adherence: Accurate prompt following
  • Lighter Architecture: Smaller model size with faster inference
  • Cost-Effective: Accessible pricing for high-volume usage
python
# Generate image with Qwen-Image-2.0
response = client.images.generate(
    model="qwen-image-2.0",
    prompt="A serene mountain landscape at sunset with 'Peace' written in elegant calligraphy",
    size="1024x1024",
    n=1,
)
print(response.data[0].url)

z-image-turbo

Fast, high-quality image generation model optimized for speed with excellent text rendering.

Key Features:

  • High-Speed Generation: Optimized for fast production workflows
  • Improved Text Rendering: Better character consistency and text generation
  • Crown Support: Add logos or watermarks to generated images
  • Flexible Sizes: 42 preset ratios plus custom sizes (512×512 to 2048×2048)
  • Thinking Mode: Optional enhanced generation at $0.030 per image
python
# Example using z-image-turbo
response = client.images.generate(
    model="z-image-turbo",
    prompt="A professional logo with text 'AI TECH' in modern minimalist style",
    size="1024x1024",
    n=1,
)

qwen-image-edit-plus

Advanced image editing model supporting complex operations including background removal, inpainting, and style transfer.

Key Features:

  • Background Removal: Isolate subjects from backgrounds
  • Image Inpainting: Fill or replace selected areas
  • Style Transfer: Apply artistic styles to images
  • Search & Recolor: Change colors in specific regions
  • Control Structure: Maintain structural consistency in edits
python
# Example using qwen-image-edit-plus for background removal
import requests

with open("input_image.png", "rb") as image_file:
    response = requests.post(
        "https://api.avalai.ir/v1/images/edits",
        headers={"Authorization": f"Bearer {api_key}"},
        files={"image": image_file},
        data={
            "model": "qwen-image-edit-plus",
            "prompt": "Remove the background and keep only the main subject",
        },
    )

Key Features

  • Dual SDK Support: Compatible with OpenAI SDK format and native Dashscope API
  • Multiple Resolutions: Support for various aspect ratios (1328×1328, 1664×928, 1472×1140, 1140×1472, 928×1664)
  • Advanced Parameters: Negative prompts, intelligent prompt rewriting, watermark control, seed support
  • High Quality: Professional-grade image generation with customizable parameters

Usage Examples

python
# Text-to-image generation using OpenAI SDK format
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

response = client.images.generate(
    model="qwen-image",
    prompt="A serene mountain landscape with a crystal clear lake reflecting snow-capped peaks",
    size="1328x1328",
    n=1,
    response_format="url",  # or b64_json
)

print(response.data[0].url)

# Image editing using OpenAI SDK format
import requests

with open("input_image.jpg", "rb") as image_file:
    response = requests.post(
        "https://api.avalai.ir/v1/images/edits",
        headers={"Authorization": f"Bearer {api_key}"},
        files={"image": image_file},
        data={
            "model": "qwen-image-edit",
            "prompt": "Change the sky to a dramatic sunset with orange and purple colors",
        },
    )

print(response.json())

Native Dashscope Format

python
# Using native Dashscope schema for advanced parameters
import requests

response = requests.post(
    "https://api.avalai.ir/v1/images/generations",
    headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
    json={
        "model": "qwen-image",
        "input": {
            "messages": [
                {
                    "role": "user",
                    "content": [
                        {
                            "text": "A professional headshot of a confident business person in modern office setting"
                        }
                    ],
                }
            ]
        },
        "parameters": {
            "size": "1328*1328",
            "prompt_extend": True,
            "watermark": False,
            "negative_prompt": "blurry, low quality, distorted",
        },
    },
)

print(response.json())

Embedding Models

Advanced embedding models for text and multimodal content, supporting semantic search, similarity calculation, and content classification.

Text Embedding Models

ModelVector DimensionsMax TokensSpecializationPricing (per 1M tokens)
text-embedding-v464-2,048 (configurable)8,192Latest generation, task instructions, sparse vectors$0.07
text-embedding-v3512-1,024 (configurable)8,192Previous generation, proven performance$0.07

text-embedding-v4

The latest generation text embedding model with advanced features:

Key Features:

  • Configurable Dimensions: 2,048, 1,536, 1,024 (default), 768, 512, 256, 128, 64
  • Task Instructions (instruct): Optimize vector quality for specific retrieval scenarios
  • Text Type Differentiation: Separate embeddings for query vs document text
  • Dense & Sparse Vectors: Generate both types for hybrid search
  • Batch Processing: Process up to 10 texts per request

Use Cases:

  • Semantic search and retrieval
  • AI chat and content recommendation
  • High-quality production search engines
  • Classification and clustering

Example:

bash
curl https://api.avalai.ir/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -d '{
    "model": "text-embedding-v4",
    "input": "Machine learning is transforming technology",
    "dimensions": 1024
  }'
python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

response = client.embeddings.create(
    model="text-embedding-v4",
    input="Machine learning is transforming technology",
    dimensions=1024,
)

print(response.data[0].embedding)
javascript
import { OpenAI } from "openai";

const client = new OpenAI({
  apiKey: process.env.AVALAI_API_KEY,
  baseURL: "https://api.avalai.ir/v1",
});

const response = await client.embeddings.create({
  model: "text-embedding-v4",
  input: "Machine learning is transforming technology",
  dimensions: 1024,
});

console.log(response.data[0].embedding);

Advanced Features with Native API:

python
# Using extra_body for advanced features
response = client.embeddings.create(
    model="text-embedding-v4",
    input="Research papers on machine learning",
    dimensions=1024,
    extra_body={
        "text_type": "query",  # or "document"
        "instruct": "Given a research paper query, retrieve relevant research papers",
    },
)

text-embedding-v3

Previous generation text embedding model with proven performance:

Key Features:

  • Configurable Dimensions: 1,024 (default), 768, 512
  • Reliable Performance: Tested across 50+ languages
  • Batch Processing: Process up to 10 texts per request

Multimodal Embedding Models

ModelVector DimensionsMax Text TokensImage/Video SupportPricing (per 1M tokens)
tongyi-embedding-vision-plus1,1521,024Images & Videos$0.09
tongyi-embedding-vision-flash7681,024Images & VideosImage/Video: $0.03, Text: $0.09

tongyi-embedding-vision-plus

Advanced multimodal embedding model supporting text, images, and videos:

Key Features:

  • Cross-Modal Retrieval: Text-to-image, image-to-video, image-to-image search
  • Semantic Similarity: Calculate similarity across different modalities
  • Multiple Inputs: Support up to 8 images per request
  • Video Support: Process videos up to 10 MB (MP4, MPEG, AVI, MOV, MPG, WEBM, FLV, MKV)
  • Image Formats: JPG, PNG, BMP (Base64 or URL)

Use Cases:

  • Cross-modal semantic search
  • Video classification and analysis
  • Image search using text or other images
  • Content classification and clustering

Example:

bash
curl https://api.avalai.ir/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -d '{
    "model": "tongyi-embedding-vision-plus",
    "input": {
      "contents": [
        {"text": "A beautiful sunset over mountains"},
        {"image": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png"}
      ]
    }
  }'
python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

# Using extra_body for native Alibaba format
response = client.embeddings.create(
    model="tongyi-embedding-vision-plus",
    input="placeholder",  # Required by OpenAI SDK
    extra_body={
        "input": {
            "contents": [
                {"text": "A beautiful sunset over mountains"},
                {
                    "image": "https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png"
                },
            ]
        }
    },
)

print(response.data[0].embedding)
javascript
import { OpenAI } from "openai";

const client = new OpenAI({
  apiKey: process.env.AVALAI_API_KEY,
  baseURL: "https://api.avalai.ir/v1",
});

// Note: For multimodal embeddings, use native HTTP requests
const response = await fetch("https://api.avalai.ir/v1/embeddings", {
    method: "POST",
    headers: {
        "Authorization": `Bearer ${process.env.AVALAI_API_KEY}`,
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        model: "tongyi-embedding-vision-plus",
        input: {
            contents: [
                { text: "A beautiful sunset over mountains" },
                { image: "https://dashscope.oss-cn-beijing.aliyuncs.com/images/256_1.png" }
            ]
        }
    })
});

const result = await response.json();
console.log(result.data[0].embedding);

tongyi-embedding-vision-flash

Fast multimodal embedding model optimized for speed:

Key Features:

  • High Speed: Optimized for fast processing
  • Multimodal Support: Text, images, and videos
  • Cost-Effective: Lower pricing for image/video processing
  • Same Capabilities: Similar features to vision-plus with faster inference

Pricing:

  • Image/Video tokens: $0.03 per 1M tokens
  • Text tokens: $0.09 per 1M tokens

Embedding Best Practices

  1. Dimension Selection:

    • Use 1024 dimensions for optimal balance of performance and cost
    • Use higher dimensions (1536, 2048) for domains requiring high precision
    • Use lower dimensions (768 or below) for cost-sensitive scenarios
  2. Text Type Differentiation (text-embedding-v4 only):

    • Use text_type: "query" for user search queries
    • Use text_type: "document" for documents in your database
  3. Task Instructions (text-embedding-v4 only):

    • Provide clear English instructions to optimize vector quality
    • Example: "Given a research paper query, retrieve relevant research papers"
  4. Multimodal Embeddings:

    • All modalities generate vectors in the same semantic space
    • Calculate cosine similarity directly between different modalities
    • Use vision-flash for high-volume applications
  5. Batch Processing:

    • Process multiple texts in a single request (up to 10)
    • Each text must not exceed token limits

Rerank Models

Rerank models perform more accurate sorting of retrieved documents to ensure the most relevant results appear at the top, essential for RAG applications and semantic search.

ModelMax DocumentsMax Tokens per ItemMax Tokens per RequestLanguagesPricing (per 1M tokens)
qwen3-rerank5004,00030,000100+ languages$0.10

qwen3-rerank

A text-ranking model trained on the Qwen LLM foundation that performs relevance ranking for input queries and candidate documents. It supports over 100 languages and long-text inputs.

Key Features:

  • High-Accuracy Ranking: Precise relevance scoring for documents
  • Multilingual Support: 100+ languages including Chinese, English, Spanish, French, Portuguese, Indonesian, Japanese, Korean, German, and Russian
  • Long Text Support: Up to 4,000 tokens per document
  • RAG Optimized: Designed for Retrieval-Augmented Generation pipelines
  • Prompt Caching: Supports cached input for cost savings

Use Cases:

  • Text semantic retrieval
  • RAG applications
  • Search result re-ranking
  • Document relevance scoring

Pricing:

TypeCost
Input Tokens$0.10 per 1M tokens
Cached Input Tokens$0.0035 per 1M tokens

Example:

bash
curl https://api.avalai.ir/v1/rerank \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -d '{
    "model": "qwen3-rerank",
    "query": "What is machine learning?",
    "documents": [
      "Machine learning is a field of study...",
      "Deep learning is a subset of machine learning...",
      "Apples are a type of fruit..."
    ]
  }'
python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

# Using the rerank endpoint
import requests

response = requests.post(
    "https://api.avalai.ir/v1/rerank",
    headers={
        "Authorization": f"Bearer {client.api_key}",
        "Content-Type": "application/json",
    },
    json={
        "model": "qwen3-rerank",
        "query": "What is machine learning?",
        "documents": [
            "Machine learning is a field of study...",
            "Deep learning is a subset of machine learning...",
            "Apples are a type of fruit...",
        ],
    },
)

print(response.json())

Example Response:

json
{
  "model": "qwen3-rerank",
  "results": [
    {
      "index": 1,
      "relevance_score": 0.98,
      "document": {
        "text": "Deep learning is a subset of machine learning..."
      }
    },
    {
      "index": 0,
      "relevance_score": 0.95,
      "document": {
        "text": "Machine learning is a field of study..."
      }
    },
    {
      "index": 2,
      "relevance_score": 0.01,
      "document": {
        "text": "Apples are a type of fruit..."
      }
    }
  ],
  "usage": {
    "total_tokens": 45
  }
}

API Endpoints and Integration

Primary Support: Chat Completions API

All Alibaba models are fully supported on the v1/chat/completions endpoint with complete feature compatibility including:

  • Function calling and tool use
  • Streaming responses
  • System messages
  • Temperature and other generation parameters
  • Multimodal inputs (for vision models)

Limited Support: Messages API

Basic text generation is available on the v1/messages endpoint for simple use cases, though full feature support is recommended via the Chat Completions API.

Usage Examples

Basic Text Generation

python
from openai import OpenAI

client = OpenAI(api_key="your-avalai-api-key", base_url="https://api.avalai.ir/v1")

response = client.chat.completions.create(
    model="qwen-plus",
    messages=[
        {"role": "user", "content": "Explain quantum computing in simple terms."}
    ],
    max_tokens=500,
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)

print(response.choices[0].message.content)
Responses API version This version uses `gpt-5.5` because `qwen-plus` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Explain quantum computing in simple terms.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Multimodal Processing

python
# Vision-language model example
response = client.chat.completions.create(
    model="qwen2.5-vl-72b-instruct",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "Describe this chart and its key insights."},
                {
                    "type": "image_url",
                    "image_url": {"url": "https://example.com/chart.png"},
                },
            ],
        }
    ],
    extra_body={"enable_thinking": False},  # Required for non-streaming requests
)
Responses API version This version uses `gpt-5.5` because `qwen2.5-vl-72b-instruct` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    input=[
        {
            "role": "user",
            "content": [
                {"type": "input_text", "text": "Describe this image."},
                {"type": "input_image", "image_url": "https://example.com/image.png"},
            ],
        }
    ],
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Streaming Response

python
# Streaming example (enable_thinking can be omitted or set to False for standard streaming)
stream = client.chat.completions.create(
    model="qwen3-max",
    messages=[
        {
            "role": "user",
            "content": "Write a detailed analysis of renewable energy trends.",
        }
    ],
    stream=True,
    # Optional: extra_body={"enable_thinking": True} only if you need thinking mode
)

for chunk in stream:
    if chunk.choices[0].delta.content is not None:
        print(chunk.choices[0].delta.content, end="")
Responses API version This version uses `gpt-5.5` because `qwen3-max` may not be enabled for `/v1/responses` in the current AvalAI model data.

Use this version when the selected model supports /v1/responses. messages moves to input, and the final text is read from response.output_text.

python
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["AVALAI_API_KEY"],
    base_url="https://api.avalai.ir/v1",
)

response = client.responses.create(
    model="gpt-5.5",
    instructions="You are a helpful assistant.",
    input="Write a detailed analysis of renewable energy trends.",
)

print(response.output_text)
  • messagesinput
  • system message → instructions or a developer item
  • choices[0].message.contentresponse.output_text
  • for tools and multimodal output, inspect response.output by item type.

Best Practices

  1. Model Selection: Choose models based on your specific needs:

    • Use Flash (e.g., qwen-flash, qwen3.6-flash) for high-throughput applications requiring speed
    • Use Plus (e.g., qwen-plus, qwen3.6-plus) for balanced performance across general tasks
    • Use Qwen3 Max (qwen3.8-max for the latest flagship; qwen3.7-max, qwen3-max, or qwen3.6-max-preview for earlier generations) for complex reasoning, agentic workflows, and long-horizon execution
    • Use Qwen3 VL models for tasks involving images
    • Use Coder models for programming-related tasks
  2. Context Management: Be mindful of context windows when processing long documents or conversations.

  3. API Optimization: Use the Chat Completions API for full feature support and the Messages API only for simple text generation.

  4. Version Management: Use specific dated versions for production applications requiring consistency.

Pricing Information

For detailed pricing information including input costs, output costs, and cache read pricing for all Alibaba models, please refer to our comprehensive Model Details documentation.