Messages API
POST /api/v1/messages accepts an Anthropic Messages request and returns the
provider response without an API Stock envelope.
Current availability: the active catalog has no model routed through the Anthropic protocol. Do not send production requests to this endpoint until a model appears in the active catalog with Anthropic support. Current Claude models use the Chat Completions API.
Request
| Field | Required | Description |
|---|---|---|
model | Yes | An active model with Anthropic protocol support. |
messages | Yes | Anthropic user and assistant turns. |
max_tokens | Yes | Maximum generated tokens; minimum 1. |
stream | No | Set true for Anthropic SSE events. |
system | No | A string or Anthropic content blocks. |
Additional Anthropic fields such as thinking, tools, tool_choice,
stop_sequences, sampling controls, and cache controls are passed through.
SDK configuration
When an Anthropic model is active, configure @anthropic-ai/sdk or the Python
anthropic client with base URL https://api.api-stock.com/api/v1 and your API
Stock key. Use the exact ID returned by GET /api/v1/catalog. Token and
prompt-cache rates are included in the same catalog response.
Streaming
Set stream: true to receive Anthropic SSE events (message_start,
content_block_delta, message_delta, message_stop). Input tokens arrive in
message_start; the running output-token count arrives in each message_delta.
Prefer streaming for long or reasoning-heavy responses. A non-streaming request holds the connection open with no bytes until the whole answer is ready, and reasoning models can take well over a minute. The CDN in front of the API caps an idle proxied connection at roughly 100 seconds and then returns a
524— with no CORS headers, so in a browser it surfaces as a misleading CORS error rather than a timeout. Streaming keeps bytes flowing, so the connection never goes idle and the limit does not apply.