Skip to main content

Qwen API Overview: Unlock Conversational AI

Qwen
info

For detailed information about using models with APIpie, check out our Models Overview and Completions Guide.

Description

The Qwen Series represents a comprehensive family of transformer-based models optimized for a wide range of NLP applications. Developed by Alibaba Cloud, these models leverage cutting-edge technology to deliver exceptional performance in conversational AI, instruction-following tasks, and extended-context interactions. The models are available through various providers integrated with APIpie's routing system.

Key Features

  • Extended Token Capacity: All models support up to 32,768 tokens for efficient handling of long-text inputs and context-rich conversations.
  • Multi-Provider Availability: Accessible across platforms like OpenRouter, EdenAI, Together, and Amazon Bedrock.
  • Diverse Subtypes: Includes Chat, Instruction, and Vision-Language variants tailored for specific applications.
  • Scalability: Models ranging from lightweight solutions (1.5B parameters) to high-capacity configurations (72B parameters) for advanced tasks.

Model List in the Qwen Series

Model List updates dynamically please see the Models Route for the up to date list of models

info

For information about model performance and benchmarks, see the Qwen Technical Report.

Model NameMax TokensResponse TokensProvidersSubtype
qwen-2-72b-instruct32,76832,768OpenRouter, EdenAI, Together, BedrockInstruction
qwen-2-7b-instruct32,76832,768OpenRouter, EdenAI, Together, BedrockInstruction
Qwen2-1.5B-Instruct32,76832,768OpenRouter, EdenAI, Together, BedrockInstruction
Qwen2-7B-Instruct32,76832,768OpenRouter, EdenAI, Together, BedrockInstruction
Qwen1.5-14B-Chat32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-1.8B-Chat32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-32B-Chat32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-7B-Chat32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-0.5B-Chat32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-4B-Chat32,76832,768OpenRouter, EdenAI, Together, BedrockChat
qwen-2-vl-7b-instruct32,76832,768OpenRouter, EdenAI, Together, BedrockVision-Language
qwen-2-vl-72b-instruct32,76832,768OpenRouter, EdenAI, Together, BedrockVision-Language
qwen-2.5-72b-instruct32,76832,768OpenRouter, EdenAI, Together, BedrockInstruction
qwen-2.5-7b-instruct32,76832,768OpenRouter, EdenAI, Together, BedrockInstruction
eva-qwen-2.5-32b32,76832,768OpenRouter, EdenAI, Together, BedrockInstruction
Qwen2-72B-Instruct32,76832,768OpenRouter, EdenAI, Together, BedrockInstruction
Qwen2-72B32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-0.5B32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-1.8B32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-4B32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-7B32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-72B32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen2-7B32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen2-1.5B32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-32B32,76832,768OpenRouter, EdenAI, Together, BedrockChat
Qwen1.5-14B32,76832,768OpenRouter, EdenAI, Together, BedrockChat
qwen1-5_32k32,76832,768OpenRouter, EdenAI, Together, BedrockChat
qwen2_32k32,76832,768OpenRouter, EdenAI, Together, BedrockChat

Example API Call

Below is an example of how to use the Chat Completions API to interact with a model from the Qwen Series, such as qwen-2-7b-instruct.

curl -L -X POST 'https://apipie.ai/v1/chat/completions' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
--data-raw '{
"provider": "openrouter",
"model": "qwen-2-7b-instruct",
"max_tokens": 150,
"messages": [
{
"role": "user",
"content": "Can you explain how photosynthesis works?"
}
]
}'

Response Example

The expected response structure for the Qwen model might look like this:

{
"id": "chatcmpl-12345example12345",
"object": "chat.completion",
"created": 1729535643,
"provider": "openrouter",
"model": "qwen-2-7b-instruct",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Photosynthesis is the process by which green plants, algae, and some bacteria convert light energy into chemical energy. Here’s how it works:\n\n1. **Light Absorption**: Plants capture light energy using a pigment called chlorophyll, which is found in chloroplasts.\n\n2. **Water and Carbon Dioxide**: They absorb water through their roots and carbon dioxide from the air.\n\n3. **Glucose Production**: The light energy is used to convert water and carbon dioxide into glucose (a sugar) and oxygen. The equation is:\n \n 6CO2 + 6H2O + light energy → C6H12O6 + 6O2\n\nThis process provides energy for the plant and releases oxygen into the atmosphere."
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 15,
"completion_tokens": 125,
"total_tokens": 140,
"prompt_characters": 45,
"response_characters": 520,
"cost": 0.002250,
"latency_ms": 3100
},
"system_fingerprint": "fp_123abc456def"
}

API Highlights

  • Provider: Specify the provider or leave blank for automatic selection.
  • Model: Use any model from the Qwen Series, such as qwen-2-7b-instruct or others suited to your task. See Models Guide.
  • Max Tokens: Set the maximum response token count (e.g., 150 in this example).
  • Messages: Format your request with a sequence of messages, including user input and system instructions. See message formatting.

This example demonstrates how to seamlessly query models from the Qwen Series for conversational or instructional tasks.


Applications and Integrations

  • Conversational AI: Powering chatbots, virtual assistants, and other dialogue-based systems. Try it with LibreChat or OpenWebUI.
  • Instructional Scenarios: Tailored for executing complex, multi-step tasks based on user inputs. See Qwen's instruction guide.
  • Vision-Language Models: Addressing multimodal tasks combining textual and visual inputs using specialized VL models. Learn more in Qwen-VL documentation.
  • Extended Context Tasks: Providing coherent responses for long-sequence inputs. See our Models Guide for details.

Ethical Considerations

The Qwen models are highly capable but lack inherent moderation systems. Users are encouraged to implement safeguards for appropriate deployment in sensitive contexts. For guidance on responsible AI usage, see Alibaba Cloud's Best Practices.


Licensing

The Qwen Series is released under flexible licensing terms, allowing for both commercial and non-commercial usage. For detailed terms, consult the official Qwen repository, model cards, and respective hosting providers.

tip

Try out the Qwen models in APIpie's various supported integrations.