Qwen3-Max | Text To Text
POST
/v1/chat/completionsAuthentication
- Sign up for an account
- Navigate to the API Keys section in your dashboard
- Generate a new API key (sk-xxxxx)
- Copy and securely store your API key
Initiate Request
curl --location 'https://api.maxtoken.io/v1/chat/completions'
--header 'Authorization: Bearer API_KEY'
--header 'Content-Type: application/json'
--data '{
"model": "qwen3-max",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "who are you?"
}
]
}
]
}'
const axios = require('axios');
let data = JSON.stringify({
"model": "qwen3-max",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "who are you?"
}
]
}
]
});
let config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.maxtoken.io/v1/chat/completions',
headers: {
'Authorization': 'Bearer API_KEY',
'Content-Type': 'application/json'
},
data : data
};
axios.request(config)
.then((response) => {
console.log(JSON.stringify(response.data));
})
.catch((error) => {
console.log(error);
});
import requests
import json
url = "https://api.maxtoken.io/v1/chat/completions"
payload = json.dumps({
"model": "qwen3-max",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "who are you?"
}
]
}
]
})
headers = {
'Authorization': 'Bearer API_KEY',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.maxtoken.io/v1/chat/completions"
method := "POST"
payload := strings.NewReader(`{
"model": "qwen3-max",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "who are you?"
}
]
}
]
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "Bearer API_KEY")
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
Parameters
Core Parameters
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
model | string | ✅ Yes | - | - | Model ID used to generate the response, like qwen-3.5. Alibaba offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models. |
messages | array | ✅ Yes | - | - | A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, images, and audio. |
messages.role | string | ✅ Yes | - | developerusersystem | The role of the messages author. |
messages.name | string | ❌ No | - | - | An optional name for the participant. Provides the model information to differentiate between participants of the same role. |
messages.content | string / array | ✅ Yes | - | - | The contents of the developer message. |
messages.content.type | string | ✅ Yes | - | textimage_url | The type of the content part |
messages.content.text | string | ❌ No | - | - | The text content |
Advanced Parameters
| Parameter | Type | Required | Default | Range | Description |
|---|---|---|---|---|---|
max_tokens | integer / null | ❌ No | - | - | The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length. |
n | integer / null | ❌ No | 1 | 1 - 10 | How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. |
response_format | object | ❌ No | - | - | An object specifying the format that the model must output. Setting to { "type": "json_object" } enables JSON mode, which guarantees the message the model generates is valid JSON. |
response_format.type | string | ✅ Yes | text | textjson_object | The type of response format. text for standard text output, json_object for JSON mode. |
tools | array | ❌ No | - | - | A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. |
tools.type | string | ✅ Yes | - | function | The type of the tool. Currently, only function is supported. |
tools.function | object | ✅ Yes | - | - | The function definition. |
tools.function.name | string | ✅ Yes | - | - | The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. |
tools.function.description | string | ❌ No | - | - | A description of what the function does, used by the model to choose when and how to call the function. |
tools.function.parameters | object | ❌ No | - | - | The parameters the functions accepts, described as a JSON Schema object. |
stream | boolean | ❌ No | false | truefalse | Whether to stream the response back incrementally. Defaults to false. |
Response Example
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1699896916,
"model": "{{model}}",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The image shows a wooden boardwalk path extending through a lush green grassland."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 1250,
"completion_tokens": 89,
"total_tokens": 1339
}
}
Error Codes
Common Error Codes
| Error Code | Error Name | Description |
|---|---|---|
| 401 | Unauthorized | API key is missing or invalid |
| 403 | Forbidden | Your API key doesn't have permission to access this resource, or insufficient balance for the requested operation |
| 429 | Too Many Requests | You've exceeded your rate limit |
| 500 | Internal server error | An internal server error occurred |
| 503 | Content policy violation | Content blocked due to safety concerns (actual status code is 400) |
