Endpoints
Anthropic Messages API
An Anthropic-compatible /v1/messages endpoint so the Anthropic SDKs and Claude Code work out of the box.
Pendra translates Anthropic's Messages format to OpenAI Chat Completions under the hood, so you can point any Anthropic SDK — or Claude Code — at Pendra and get Anthropic-shaped responses back. The Python and JavaScript examples use the official Anthropic SDKs; only the base URL and key change.
Authentication
Send your Pendra API key on the x-api-key header (Anthropic
convention). The Authorization: Bearer header also works for
OpenAI-style clients.
model string required max_tokens integer required messages array required { role, content } objects.
system string | array stream boolean default: false true for Anthropic-format SSE (see Streaming below).
tools array tool_choice.
Other optional fields
temperature,top_p,top_k,stop_sequences— standard sampling controls.
Response
Pendra returns the Anthropic message envelope (see example).
content is an array of content blocks (text, tool_use, etc.).
stop_reason is "end_turn" on a natural finish or
"max_tokens" when capped. usage uses Anthropic
naming (input_tokens / output_tokens).
Streaming
Set "stream": true to receive Anthropic-format SSE events
(message_start, content_block_delta,
message_delta, message_stop).
event: message_start
data: {"type":"message_start","message":{"id":"msg_01N3Xc8","type":"message","role":"assistant","content":[],"model":"qwen3.6:27b","stop_reason":null,"usage":{"input_tokens":9,"output_tokens":0}}}
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}}
event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"output_tokens":2}}
event: message_stop
data: {"type":"message_stop"} Use with Claude Code
Point Claude Code at Pendra by setting two environment variables — see the full recipe in Integrations → Claude Code.