Skip to main content
POST
/
models
/
v2
/
Qwen
/
Qwen3-4B
chat
curl --request POST \
  --url https://api.bytez.com/models/v2/Qwen/Qwen3-4B \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data @- <<EOF
{
  "messages": [
    {
      "role": "system",
      "content": "You are a friendly chatbot"
    },
    {
      "role": "assistant",
      "content": "Hello, I'm a friendly bot"
    },
    {
      "role": "user",
      "content": "Hello bot, what is the capital of England?"
    }
  ],
  "stream": true,
  "params": {
    "min_length": 10,
    "max_length": 100,
    "temperature": 0.5
  }
}
EOF
{
  "error": "<string>",
  "output": {
    "role": "assistant",
    "content": "Aaaaaaaargh matey"
  }
}

Authorizations

Authorization
string
header
required

Set Authorization header to BYTEZ_KEY 'Authorization: YOUR_BYTEZ_KEY_HERE'

Body

application/json

Schema for chat models

messages
object[]
required

Conversation history.

Example:
[
  {
    "role": "system",
    "content": "You are a friendly chatbot"
  },
  {
    "role": "assistant",
    "content": "Hello, I'm a friendly bot"
  },
  {
    "role": "user",
    "content": "Hello bot, what is the capital of England?"
  }
]
stream
boolean

Enable text streaming.

params
object

Model-specific parameters.

Response

Successful chat response.

error
string | null
required

Null on success; otherwise an error message.

output
object
required

The output message generated by the model

Example:
{
  "role": "assistant",
  "content": "Aaaaaaaargh matey"
}