Skip to main content
POST
/
v1
/
chat
/
completions
curl --request POST \
  --url https://api.powertokens.ai/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "qwen3-coder-plus",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "Hello, please introduce yourself."
    }
  ],
  "temperature": 0.7,
  "max_tokens": 2000
}
'
{
  "id": "<string>",
  "object": "chat.completion",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "index": 123,
      "message": {
        "content": "<string>",
        "tool_calls": [
          {}
        ]
      },
      "finish_reason": "<string>"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

Pass Authorization: Bearer <token> in the request header.

Body

application/json
model
enum<string>
required

Model name. Only publicly available chat models in the current Ali channel's final whitelist are supported.

Available options:
qwen3-coder-plus
Example:

"qwen3-coder-plus"

messages
object[]
required

List of conversation messages. Supports text content and multimodal content (image + text).

stream
boolean
default:true

Whether to use streaming output. Defaults to false.

temperature
number
default:0.7

Sampling temperature, controls output randomness. Range [0, 2].

Required range: 0 <= x <= 2
top_p
number
default:0.95

Nucleus sampling probability threshold.

Required range: 0 <= x <= 1
max_tokens
integer

Maximum number of tokens to generate.

Required range: x >= 1
stop
string[]

List of stop sequences.

seed
integer

Random seed for reproducible generation results.

tools
object[]

List of tools for Function Calling.

tool_choice
string

Tool selection strategy. Possible values: auto, none, required.

Whether to enable search-augmented generation. Only supported by some models.

response_format
object

Response format, used to force the model to output JSON.

Response

Success. Returns the chat completion result. In streaming mode, returns an SSE stream.

id
string

Unique response identifier.

object
string
Example:

"chat.completion"

created
integer<int64>

Creation time as a Unix timestamp (seconds).

model
string

Model name used.

choices
object[]
usage
object