Qwen 3.8 Max·续

</details>

<details>

<summary>Streaming Response — Enable streaming for real-time output</summary>

const response = await env.AI.run(
  'alibaba/qwen3.8-max',
  {
    messages: [{ content: 'Explain the concept of recursion with a simple example.', role: 'user' }],
    stream: true,
    stream_options: { include_usage: true },
  },
)
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.8-max",
  "messages": [
    {
      "content": "Explain the concept of recursion with a simple example.",
      "role": "user"
    }
  ],
  "stream": true,
  "stream_options": {
    "include_usage": true
  }
}'
Recursion is a way of solving a problem where a function calls itself to solve smaller versions of the same problem.

A recursive function usually has two parts:

1. **Base case** — when to stop  
2. **Recursive case** — calling itself with a smaller input

Example: calculating `3!` factorial.

```python
def factorial(n):
    if n == 1:          # base case
        return 1
    else:
        return n * factorial(n - 1)  # recursive case
```

Calling:

```python
print(factorial(3))
```

This works like:

```python
factorial(3) = 3 * factorial(2)
factorial(2) = 2 * factorial(1)
factorial(1) = 1
```

So:

```python
3 * 2 * 1 = 6
```

Recursion is useful when a problem can be broken into smaller repeated subproblems.
[
  {
    "model": "qwen3.8-max",
    "id": "chatcmpl-93de192c-09a4-9b99-8c9a-55f6302cc5c5",
    "created": 1786048673,
    "object": "chat.completion.chunk",
    "usage": null,
    "choices": [
      {
        "logprobs": null,
        "index": 0,
        "delta": {
          "content": "",
          "role": "assistant",
          "reasoning_content": ""
        },
        "finish_reason": null
      }
    ]
  },
  {
    "model": "qwen3.8-max",
    "id": "chatcmpl-93de192c-09a4-9b99-8c9a-55f6302cc5c5",
    "choices": [
      {
        "delta": {
          "content": "",
          "reasoning_content": "We"
        },
        "index": 0,
        "finish_reason": null,
        "logprobs": null
      }
    ],
    "created": 1786048673,
    "object": "chat.completion.chunk",
    "usage": null
  },
  "... 73 more chunks omitted ...",
  {
    "choices": [],
    "created": 1786048673,
    "id": "chatcmpl-93de192c-09a4-9b99-8c9a-55f6302cc5c5",
    "model": "qwen3.8-max",
    "object": "chat.completion.chunk",
    "usage": {
      "completion_tokens": 263,
      "completion_tokens_details": {
        "reasoning_tokens": 47,
        "text_tokens": 263
      },
      "prompt_tokens": 59,
      "prompt_tokens_details": {
        "cached_tokens": 0,
        "text_tokens": 59
      },
      "total_tokens": 322
    }
  }
]

</details>

Parameters

Schema variant

Chat CompletionsResponses

▶messages[]

arrayrequired

temperature

numberminimum: 0maximum: 2

max_tokens

numberexclusiveMinimum: 0

max_completion_tokens

numberexclusiveMinimum: 0

top_p

numberminimum: 0maximum: 1

frequency_penalty

numberminimum: -2maximum: 2

presence_penalty

numberminimum: -2maximum: 2

stream

boolean

▶stream_options{}

object

▶tools[]

array

tool_choice

response_format

▶modalities[]

array

▶audio{}

object

reasoning_effort

stringOptional reasoning control; availability and accepted values are model-dependent.

▶input

one ofrequired

instructions

string

temperature

numberminimum: 0maximum: 2

max_output_tokens

numberexclusiveMinimum: 0

top_p

numberminimum: 0maximum: 1

stream

boolean

▶tools[]

array

tool_choice

▶text{}

object

▶reasoning{}

object

id

string

object

string

created

number

model

string

▶choices[]

array

▶usage{}

object

id

string

object

stringconst: response

created_at

number

model

string

▶output[]

array

output_text

string

status

stringenum: in_progress, completed, failed, incomplete

▶usage{}

object

API Schemas (Raw)

Input Open Download

Output Open Download

Was this helpful?

YesNo

On this page

Qwen 3.8 Max·续 - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ai/models/alibaba/qwen3.8-max/#page","headline":"Qwen 3.8 Max","description":"Alibaba's Qwen 3.8 Max is a 2.4-trillion-parameter MoE flagship built for professional-grade coding and long-horizon autonomous work, capable of delivering complete, production-grade projects spanning 10+ days across legal, financial, design, and other specialized domains. Native visual understanding of images and extended video runs through the full plan-execute-verify cycle, served via DashScope's OpenAI-compatible endpoint.","url":"https://developers.cloudflare.com/ai/models/alibaba/qwen3.8-max/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Alibaba's Wan 2.6 text-to-image model generating images from text prompts with optional negative prompts and customizable dimensions. title: Wan 2.6 Image image: https://developers.cloudflare.com/og-docs.png


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/llms.txt
Use this file to discover all available pages before exploring further.

Alibaba logo