Create an Anthropic-compatible message
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', max_tokens: 123, messages: [{content: '<string>'}]})
};
fetch('https://www.ninjachat.ai/api/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://www.ninjachat.ai/api/v1/messages"
payload = {
"model": "<string>",
"max_tokens": 123,
"messages": [{ "content": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://www.ninjachat.ai/api/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"max_tokens": 123,
"messages": [
{
"content": "<string>"
}
]
}
'{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Text
Create an Anthropic-compatible message
Messages compatibility for text, image inputs, JSON output schemas, function tools and SSE. Accepts Authorization bearer or x-api-key. Uses the same metered gateway, routing and idempotency as Chat Completions. Native server tools, file IDs and signed thinking history are not supported; unsupported parameters return explicit errors.
POST
/
messages
Create an Anthropic-compatible message
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', max_tokens: 123, messages: [{content: '<string>'}]})
};
fetch('https://www.ninjachat.ai/api/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://www.ninjachat.ai/api/v1/messages"
payload = {
"model": "<string>",
"max_tokens": 123,
"messages": [{ "content": "<string>" }]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)curl --request POST \
--url https://www.ninjachat.ai/api/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"max_tokens": 123,
"messages": [
{
"content": "<string>"
}
]
}
'{}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
bearerAuthanthropicApiKey
Use an API key created in the NinjaChat developer console.
Headers
Safely retry the same logical write without duplicate billing or execution.
Required string length:
1 - 255Body
application/json
Required string length:
1 - 160Required range:
x <= 9007199254740991Required array length:
1 - 100 elementsShow child attributes
Show child attributes
Required range:
0 <= x <= 1Required range:
0 <= x <= 1Maximum array length:
4Maximum array length:
32Show child attributes
Show child attributes
- Option 1
- Option 2
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
Anthropic Message object or Messages SSE lifecycle.
The response is of type object.