Messages (Anthropic)
POST /v1/messages is the Anthropic-compatible endpoint for Claude-native clients, agents and tools that expect Anthropic request and streaming shapes.
Use it when
- Your application already targets the Anthropic Messages API.
- You use Claude Code, Cline or another Anthropic-compatible agent.
- You need Anthropic-style
system,tools,tool_choiceor streaming events.
Code examples
curl https://api.prismaticapi.com/v1/messages \
-H "x-api-key: $PRISMATIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 400,
"messages": [
{ "role": "user", "content": "Draft a deployment checklist." }
]
}'import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: process.env.PRISMATIC_API_KEY,
baseURL: "https://api.prismaticapi.com"
});
const message = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 400,
messages: [{ role: "user", content: "Draft a deployment checklist." }]
});Parameters
model(string, required) — Public model ID returned byGET /v1/models.messages(array, required) — Array withrole(userorassistant) andcontent.max_tokens(integer, required) — Maximum tokens to generate.system(string or array, optional) — System prompt as a string or text blocks.stream(boolean, optional) — Enables Anthropic-style SSE streaming.temperature(number, optional) — Sampling temperature.top_p(number, optional) — Nucleus sampling threshold.top_k(integer, optional) — Top-K sampling parameter.stop_sequences(array, optional) — Array of stop sequences.tools(array, optional) — Anthropic-format tool definitions.tool_choice(object, optional) — Tool choice strategy such astype=auto,type=anyor a named tool choice.
Authentication
- Preferred Anthropic-style header:
x-api-key: pa_YOUR_KEY. - Also send
anthropic-version: 2023-06-01for Anthropic-compatible clients. - Bearer authentication is also accepted for direct HTTP clients.
Notes
- Use
/v1/messages/count_tokensto estimate input tokens before generation. - Streaming PAYG settlement requires the client to consume the stream to completion.
- Vision and tools depend on the selected public model capabilities.