Skip to main content
POST
/
v1
/
messages
Create a message (Anthropic-compatible)
curl --request POST \
  --url https://litellm-rust.onrender.com/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "anthropic/*",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "max_tokens": 1024,
  "stream": false
}
'
import requests

url = "https://litellm-rust.onrender.com/v1/messages"

payload = {
"model": "anthropic/*",
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"max_tokens": 1024,
"stream": False
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'anthropic/*',
messages: [{role: 'user', content: 'Hello!'}],
max_tokens: 1024,
stream: false
})
};

fetch('https://litellm-rust.onrender.com/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
{
  "id": "<string>",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "<string>"
    }
  ],
  "model": "<string>",
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123
  }
}

Authorizations

Authorization
string
header
required

Your LITELLM_MASTER_KEY. Default for local Docker Compose: sk-local

Body

application/json
model
string
required

Model alias from config. Available: anthropic/*, gpt-5.5

Example:

"anthropic/*"

messages
object[]
required
Example:
[{ "role": "user", "content": "Hello!" }]
max_tokens
integer
required
Example:

1024

stream
boolean
Example:

false

Response

Message response from upstream provider

id
string
type
string
Example:

"message"

role
string
Example:

"assistant"

content
object[]
model
string
stop_reason
string
Example:

"end_turn"

usage
object