qwen-guide · EN · 2026-09-27

Qwen: getting started

A practical introduction to using Qwen models through the aggregator's OpenAI-compatible API, covering setup, a minimal code example, key model features, and use cases.

What is Qwen?

Qwen is a family of large language models developed by Alibaba Cloud. Known for strong multilingual performance, especially in Chinese and English, Qwen models are available in various sizes and capabilities, including general-purpose chat, reasoning, and coding-focused variants. Through the aggregator, you can access Qwen models using the same API key you use for other supported providers.

Why use Qwen via the aggregator?

  • Single API key: Access Qwen alongside Claude, GPT, DeepSeek, and others without managing multiple credentials.
  • Unified interface: The aggregator exposes an OpenAI-compatible endpoint, so existing OpenAI SDK code works with minimal changes.
  • No KYC: Top up with USDC on Base and start calling models.
  • Transparent pricing: You pay the official price multiplied by 1.3, with no hidden fees. Key contributors can earn credits at official price × 1.1 (or × 1.2 for premium models).

Prerequisites

Before you begin, ensure you have:

  • An account with the aggregator and a valid API key.
  • A positive balance (top up with USDC on Base).
  • Python 3.7+ or Node.js installed, depending on your preferred language.

Minimal example (Python)

Below is a minimal example using the OpenAI Python SDK, pointed at the aggregator's base URL. Replace YOURAPIKEY with your actual key.

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.aggregator.example/v1"  # Replace with the actual base URL
)

response = client.chat.completions.create(
    model="qwen-max",  # Replace with a valid Qwen model ID
    messages=[
        {"role": "user", "content": "Hello, how are you?"}
    ]
)

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

Minimal example (Node.js)

If you prefer JavaScript, here is the equivalent using the OpenAI Node SDK.

import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'YOUR_API_KEY',
  baseURL: 'https://api.aggregator.example/v1' // Replace with the actual base URL
});

async function main() {
  const response = await client.chat.completions.create({
    model: 'qwen-max', // Replace with a valid Qwen model ID
    messages: [{ role: 'user', content: 'Hello, how are you?' }]
  });
  console.log(response.choices[0].message.content);
}

main();

Choosing the right Qwen model

Qwen offers several model variants. The exact list and capabilities are subject to change, but common categories include:

  • Qwen-Max: The most capable general-purpose model.
  • Qwen-Plus: Balanced performance and cost.
  • Qwen-Turbo: Fast and economical for simpler tasks.
  • Qwen-Coder: Specialized for code generation and understanding.

Check the aggregator's model catalog for the current list of available Qwen models and their specific IDs.

Common use cases

  • Multilingual chat: Qwen excels at Chinese and English conversations.
  • Content generation: Drafting articles, summaries, and creative writing.
  • Code assistance: With Qwen-Coder models, you can get help with programming tasks.
  • Reasoning: Some Qwen models are tuned for complex reasoning and problem-solving.

Best practices

  • Start with a smaller model: Use Qwen-Turbo or Qwen-Plus for prototyping to manage costs.
  • Set max tokens: Control response length and cost by specifying max_tokens.
  • Use system prompts: Guide the model's behavior with a clear system message.
  • Handle errors: Implement retries for rate limits or transient errors.

Billing and contribution

When you use Qwen through the aggregator, you pay the official price multiplied by 1.3. If you contribute to the aggregator (e.g., by adding models or improving documentation), you can earn credits at official price × 1.1, or × 1.2 for premium models, paid in USDC. This model encourages community contributions while keeping access simple.

Next steps

  • Explore other models available through the aggregator.
  • Read the API reference for advanced parameters.
  • Join the community to share feedback and get support.