> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anyfast.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Qwen3.7-Max

> Use the Qwen3.7-Max text-only model through AnyFast's OpenAI-compatible API.

Qwen3.7-Max is Alibaba's flagship Qwen3.7 text model, available through AnyFast's OpenAI-compatible Chat Completions API at `POST /v1/chat/completions`. Use the model ID `qwen3.7-max` for text generation, reasoning, function calling, and structured output.

## Key capabilities

* **1M-token context window** — The upstream specification allows 1,000,000 tokens.
* **131,072-token maximum output** — Upstream limit; available output also depends on context.
* **Text-only input** — Accept text messages.
* **Text output** — Return text responses.
* **Thinking mode** — Enabled by default and can be disabled.

## Quick example

```bash cURL theme={null}
curl --request POST \
  --url https://www.anyfast.ai/v1/chat/completions \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "qwen3.7-max",
  "messages": [
    {
      "role": "user",
      "content": "Explain a solar eclipse in one sentence."
    }
  ],
  "max_completion_tokens": 1024,
  "enable_thinking": false
}'
```

```python Python theme={null}
from openai import OpenAI

client = OpenAI(api_key="YOUR_API_KEY", base_url="https://www.anyfast.ai/v1")
response = client.chat.completions.create(
    model="qwen3.7-max",
    messages=[{"role": "user", "content": "Explain a solar eclipse in one sentence."}],
    max_completion_tokens=1024,
    extra_body={"enable_thinking": False},
)
print(response.choices[0].message.content)
```

## Input modality

This model accepts text input and returns text. Do not send `image_url` or `video_url` parts to this model.

## Thinking and structured output

Thinking is enabled by default. Set `enable_thinking` to `false` to omit the reasoning step. In the OpenAI SDK, pass this provider-specific field through `extra_body`. A non-thinking `json_object` request succeeded through AnyFast for `qwen3.7-max`.

```python Python theme={null}
response = client.chat.completions.create(
    model="qwen3.7-max",
    messages=[{"role": "user", "content": "Return a JSON object with an answer key."}],
    response_format={"type": "json_object"},
    extra_body={"enable_thinking": False},
)
print(response.choices[0].message.content)
```

## Function calling

Define functions in `tools`. When the model returns `finish_reason: "tool_calls"` and `message.tool_calls`, execute the function in your application and continue the conversation. This request shape succeeded through AnyFast. Use `tool_choice: "required"` to require a tool call.

```python Python theme={null}
tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get weather for a city",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]
response = client.chat.completions.create(
    model="qwen3.7-max",
    messages=[{"role": "user", "content": "Call get_weather for Singapore."}],
    tools=tools,
    tool_choice="required",
    extra_body={"enable_thinking": False},
)
print(response.choices[0].message.tool_calls)
```

## Streaming

Set `stream=True` to receive SSE chunks. The verified final usage-only chunk has `usage` and an empty `choices` array.

```python Python theme={null}
stream = client.chat.completions.create(
    model="qwen3.7-max",
    messages=[{"role": "user", "content": "Say hello briefly."}],
    stream=True,
    stream_options={"include_usage": True},
    extra_body={"enable_thinking": False},
)
for chunk in stream:
    if chunk.choices:
        print(chunk.choices[0].delta.content or "", end="")
    if chunk.usage:
        print("\nTotal tokens:", chunk.usage.total_tokens)
```

## Parameters

| Parameter | Type | Required | Description |
| - | - | -: | - |
| `model` | string | Yes | Exact ID: `qwen3.7-max`. |
| `messages` | array | Yes | Conversation messages; text content only. |
| `max_completion_tokens` | integer | No | Maximum generated tokens; upstream limit is 131,072. |
| `enable_thinking` | boolean | No | Defaults to true; false disables thinking. |
| `stream` | boolean | No | Return Server-Sent Events when true. |
| `stream_options` | object | No | Set `include_usage: true` to receive usage in the final stream chunk. |
| `tools` | array | No | Functions available to the model. |
| `tool_choice` | string | No | Verified with `required`; `auto` and `none` are also available. |
| `response_format` | object | No | `json_object` was verified with thinking disabled. |

> **[API Reference](https://docs.anyfast.ai/api-reference/model-api/alibaba/qwen3.7-max.md)**
>
> Request and response fields for Qwen3.7-Max.

## Official references

* [Alibaba Cloud Qwen3.7-Max model information](https://help.aliyun.com/en/model-studio/qwen3-7-max)
* [OpenAI-compatible Chat Completions API](https://help.aliyun.com/en/model-studio/qwen-api-via-openai-chat-completions)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.