Qwen 3 Max

Text Generation • Alibaba

alibaba/qwen3-max

  • Third-party
  • Zero data retention

Alibaba's Qwen 3 Max is a large language model with strong coding, reasoning, and multilingual capabilities, served via DashScope's OpenAI-compatible endpoint.

Model Info
Terms and License link ↗
More information link ↗
Zero data retention Yes
Request formats Chat Completions, Responses
Pricing <ul><li>Input (per 1M tokens)$1.20</li><li>Output (per 1M tokens)$6.00</li></ul>

Usage

const response = await env.AI.run(
  'alibaba/qwen3-max',
  { messages: [{ content: 'What are the three laws of thermodynamics?', role: 'user' }] },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "alibaba/qwen3-max",
  "messages": [
    {
      "content": "What are the three laws of thermodynamics?",
      "role": "user"
    }
  ]
}'
The three laws of thermodynamics are fundamental principles that describe the behavior of energy and entropy in physical systems:

1. **Zeroth Law of Thermodynamics**:  
   *If two systems are each in thermal equilibrium with a third system, then they are in thermal equilibrium with each other.*  
   This law establishes the concept of temperature and justifies the use of thermometers.

2. **First Law of Thermodynamics** (Law of Energy Conservation):  
   *Energy cannot be created or destroyed in an isolated system; it can only change forms.*  
   Mathematically, this is often expressed as:  
   \[
   \Delta U = Q - W
   \]  
   where \(\Delta U\) is the change in internal energy of the system, \(Q\) is the heat added to the system, and \(W\) is the work done by the system.

3. **Second Law of Thermodynamics**:  
   *The total entropy of an isolated system can never decrease over time; it either increases or remains constant in ideal reversible processes.*  
   This law introduces the concept of irreversibility and explains why certain processes occur spontaneously in one direction (e.g., heat flows from hot to cold).

There is also a **Third Law of Thermodynamics**, which is sometimes included as the fourth in historical contexts but is now standardly recognized as the third:

4. **Third Law of Thermodynamics**:  
   *As the temperature of a system approaches absolute zero, the entropy of the system approaches a constant minimum value.*  
   In practical terms, it implies that absolute zero (0 K) cannot be reached in a finite number of steps.

So, while commonly referred to as “three laws,” modern physics includes **four**—with the Zeroth Law added later for logical completeness, even though it was formulated after the first three.
{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "logprobs": null,
      "message": {
        "content": "The three laws of thermodynamics are fundamental principles that describe the behavior of energy and entropy in physical systems:\n\n1. **Zeroth Law of Thermodynamics**:  \n   *If two systems are each in thermal equilibrium with a third system, then they are in thermal equilibrium with each other.*  \n   This law establishes the concept of temperature and justifies the use of thermometers.\n\n2. **First Law of Thermodynamics** (Law of Energy Conservation):  \n   *Energy cannot be created or destroyed in an isolated system; it can only change forms.*  \n   Mathematically, this is often expressed as:  \n   \\[\n   \\Delta U = Q - W\n   \\]  \n   where \\(\\Delta U\\) is the change in internal energy of the system, \\(Q\\) is the heat added to the system, and \\(W\\) is the work done by the system.\n\n3. **Second Law of Thermodynamics**:  \n   *The total entropy of an isolated system can never decrease over time; it either increases or remains constant in ideal reversible processes.*  \n   This law introduces the concept of irreversibility and explains why certain processes occur spontaneously in one direction (e.g., heat flows from hot to cold).\n\nThere is also a **Third Law of Thermodynamics**, which is sometimes included as the fourth in historical contexts but is now standardly recognized as the third:\n\n4. **Third Law of Thermodynamics**:  \n   *As the temperature of a system approaches absolute zero, the entropy of the system approaches a constant minimum value.*  \n   In practical terms, it implies that absolute zero (0 K) cannot be reached in a finite number of steps.\n\nSo, while commonly referred to as “three laws,” modern physics includes **four**—with the Zeroth Law added later for logical completeness, even though it was formulated after the first three.",
        "role": "assistant"
      }
    }
  ],
  "created": 1776471062,
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "id": "chatcmpl-1cc68967-fae9-9f2f-aa72-ec0674038c0a",
  "model": "qwen3-max",
  "object": "chat.completion",
  "system_fingerprint": null,
  "usage": {
    "completion_tokens": 375,
    "prompt_tokens": 17,
    "prompt_tokens_details": {
      "cached_tokens": 0
    },
    "total_tokens": 392
  }
}

Examples

<details>

<summary>With System Message — Using a system message to set context</summary>

const response = await env.AI.run(
  'alibaba/qwen3-max',
  {
    messages: [
      { content: 'You are a helpful coding assistant specializing in Python.', role: 'system' },
      { content: 'How do I read a JSON file in Python?', role: 'user' },
    ],
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "alibaba/qwen3-max",
  "messages": [
    {
      "content": "You are a helpful coding assistant specializing in Python.",
      "role": "system"
    },
    {
      "content": "How do I read a JSON file in Python?",
      "role": "user"
    }
  ]
}'

``` To read a JSON file in Python, you can use the built-injson` module. Here's the basic approach:

Basic Example

```python import json