Anthropic

Anthropic Messages — drop-in proxy for Claude Code

Anthropic-shape Messages endpoint. Translates the request into OpenAI Chat Completions internally and dispatches to the resolved EndpointConfig (token binding → global "Anthropic Proxy Backend" → model: "toolpiper:tp-<id>" prefix override).

Authenticated via Authorization: Bearer tp_<64 hex> (Claude Code's ANTHROPIC_AUTH_TOKEN path), validated by the unified middleware against the same token store as every other authenticated route. Errors return Anthropic-shape envelopes ({type: "error", error: {type, message}}), never the OpenAI shape — middleware-emitted 401/403/421 responses are remapped to Anthropic-shape via authErrorResponse(forPath:...).

Streaming (stream: true) emits the canonical Anthropic SSE sequence: message_start → (content_block_start → content_block_delta+ → content_block_stop)+ → message_delta → message_stop, with ping keepalives every 15 s.

See docs/features/anthropic-api-proxy.md for the full Protocol Coverage Matrix.

post/v1/messages

Request

  • Base URL: http://localhost:9998
  • URL: http://localhost:9998/v1/messages
  • Auth: HTTP bearer

Request body

modelstring required
max_tokensinteger required
temperaturenumber
top_pnumber
top_kinteger
stop_sequencesstring[]
streamboolean
metadataobject

Response

Buffered (stream: false): a single Anthropic Message JSON object. Streaming (stream: true): text/event-stream with the Anthropic SSE sequence.

idstring required

Synthesized: msg_<22-char-base62>

type'message' required
role'assistant' required
modelstring required

The upstream model the EndpointConfig actually called (NOT the client's request string).

stop_reason'end_turn' | 'max_tokens' | 'stop_sequence' | 'tool_use' nullable required
stop_sequencestring nullable required

Changes

No recorded changes to this operation across all 1 revision of this API.