Messages (Anthropic format)
curl --request POST \
--url https://api.xhuoapi.ai/v1/messages \
--header 'Content-Type: application/json' \
--header 'anthropic-version: <anthropic-version>' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "claude-sonnet-4-6",
"max_tokens": 256,
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}
'import requests
url = "https://api.xhuoapi.ai/v1/messages"
payload = {
"model": "claude-sonnet-4-6",
"max_tokens": 256,
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}
headers = {
"anthropic-version": "<anthropic-version>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'anthropic-version': '<anthropic-version>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'claude-sonnet-4-6',
max_tokens: 256,
messages: [{role: 'user', content: 'Hello'}]
})
};
fetch('https://api.xhuoapi.ai/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));Endpoints
Messages (Anthropic format)
Anthropic Messages format for Claude models. This is the endpoint Claude Code and the Anthropic SDK use.
POST
/
messages
Messages (Anthropic format)
curl --request POST \
--url https://api.xhuoapi.ai/v1/messages \
--header 'Content-Type: application/json' \
--header 'anthropic-version: <anthropic-version>' \
--header 'x-api-key: <api-key>' \
--data '
{
"model": "claude-sonnet-4-6",
"max_tokens": 256,
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}
'import requests
url = "https://api.xhuoapi.ai/v1/messages"
payload = {
"model": "claude-sonnet-4-6",
"max_tokens": 256,
"messages": [
{
"role": "user",
"content": "Hello"
}
]
}
headers = {
"anthropic-version": "<anthropic-version>",
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'anthropic-version': '<anthropic-version>',
'x-api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model: 'claude-sonnet-4-6',
max_tokens: 256,
messages: [{role: 'user', content: 'Hello'}]
})
};
fetch('https://api.xhuoapi.ai/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));Fill in your token in the playground to send a real request. Requests are billed like any other call.
Authorizations
apiKeyAuthbearerAuth
Same token, Anthropic-style header
Headers
Body
application/json
Response
Message