Messages
Use the Anthropic-compatible Messages API when your client expects Anthropic headers and message fields, while Velrix still controls gateway policy, keys, and logs.
Endpoint
Endpoint
Use the Anthropic-compatible base URL for clients that send x-api-key and anthropic-version headers.
Method
Create an Anthropic-style message.
POST /v1/messagesBase URL
Anthropic-compatible Velrix endpoint.
https://api.velrix.aiAuthentication
Headers
Anthropic's API uses an x-api-key header and an anthropic-version header. Velrix accepts your scoped Velrix key in this provider-compatible shape.
x-api-key
Scoped Velrix API key.
$VELRIX_API_KEYanthropic-version
Anthropic API version header.
2023-06-01anthropic-beta
Optional beta feature header for routes that require beta flags.
feature-nameContent-Type
Requests and responses use JSON.
application/jsonSchema
Body parameters
These are the primary Anthropic Messages fields. Velrix forwards compatible fields to the selected upstream route when supported.
modelRequired
Model ID to route. Use claude-sonnet-4-6 for policy routing or a catalog model ID.
max_tokensRequired
Maximum number of tokens to generate. Anthropic requires this field for Messages requests.
messagesRequired
Conversation messages using Anthropic-style user and assistant roles.
systemOptional
System prompt. Anthropic documents system as a top-level parameter, not a message role.
metadataOptional
Attach request metadata, including user identifiers or operational context when supported.
service_tierOptional
Select the requested service tier for latency/capacity behavior when supported by the route.
stop_sequencesOptional
Custom sequences that cause generation to stop when encountered.
streamOptional
Return incremental server-sent events when set to true.
temperature / top_p / top_kOptional
Sampling controls. Use one primary randomness control for predictable production behavior.
thinkingOptional
Configure extended thinking behavior for Anthropic models that support it.
tools / tool_choiceOptional
Define client tools and control whether tool use is automatic or constrained.
Request
Request example
Send Anthropic-style messages with max_tokens and the required version header.
curl https://api.velrix.ai/v1/messages \
-H "x-api-key: $VELRIX_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 512,
"system": "Answer with concise operational detail.",
"metadata": {
"user_id": "dashboard-docs"
},
"messages": [
{
"role": "user",
"content": "Summarize the failed deployment."
}
],
"temperature": 0.2
}'import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.VELRIX_API_KEY,
baseURL: "https://api.velrix.ai",
});
const message = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 512,
system: "Answer with concise operational detail.",
messages: [
{
role: "user",
content: "Summarize the failed deployment.",
},
],
});
console.log(message.content);import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.VELRIX_API_KEY,
baseURL: "https://api.velrix.ai",
});
const stream = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 512,
stream: true,
messages: [{ role: "user", content: "Write a rollout note." }],
});
for await (const event of stream) {
console.log(event.type);
}Response
Response 200
Messages responses include content blocks and usage metadata in the Anthropic-compatible shape.
{
"id": "msg_013Zva2CMHLNnXjNJJKqJ2EF",
"container": {
"id": "id",
"expires_at": "2019-12-27T18:11:19.117Z"
},
"content": [
{
"citations": [
{
"cited_text": "cited_text",
"document_index": 0,
"document_title": "document_title",
"end_char_index": 0,
"file_id": "file_id",
"start_char_index": 0,
"type": "char_location"
}
],
"text": "Hi! My name is Claude.",
"type": "text"
}
],
"model": "claude-opus-4-6",
"role": "assistant",
"stop_details": {
"category": "cyber",
"explanation": "explanation",
"type": "refusal"
},
"stop_reason": "end_turn",
"stop_sequence": null,
"type": "message",
"usage": {
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"cache_creation_input_tokens": 2051,
"cache_read_input_tokens": 2051,
"inference_geo": "inference_geo",
"input_tokens": 2095,
"output_tokens": 503,
"server_tool_use": {
"web_fetch_requests": 2,
"web_search_requests": 0
},
"service_tier": "standard"
}
}Routing
Routing notes
Anthropic-compatible requests use the same Velrix operational model as OpenAI-compatible requests.
Native message schema
Keep Anthropic-style client code on its expected fields.
Scoped keys
Reuse Velrix key scopes, quotas, and environment separation.
Policy routing
Route by model policy without changing Anthropic-compatible clients.
Streaming
Use stream: true for server-sent event streaming when the selected route supports it.