Skip to main content
Valar’s POST /v1/messages endpoint speaks the Anthropic Messages API, so the official Anthropic Python SDK and the Claude Agent SDK work against Valar with a base URL and key change. The same models and completion windows work as on the Responses and Chat Completions surfaces; see the API support matrix for the full feature list.

Anthropic Python SDK

Point the SDK at Valar. Use auth_token (sends Authorization: Bearer) — or api_key (sends x-api-key); Valar accepts both.
The full Anthropic surface is supported — system prompts, tools, thinking, stop_sequences, top_k, stream: true, and structured outputs via output_config.format. System prompts go in the top-level system field, not as a role: "system" message. Reasoning-capable models emit thinking blocks by default; control the depth with thinking or output_config.effort (low / medium / high / xhigh / max). Use max_tokens generously (thinking counts toward the output budget) and iterate content for the text block rather than indexing content[0].

Streaming

Choose a completion window

Set the window either in the request body or through a header. The body field takes precedence when both are set.
Accepted values are "asap" (Now), "priority", "standard", and "flex". See Inference modes.
"flex" targets a ~5-minute turn time and is designed for background use. The Messages API has no background parameter, so a synchronous flex call blocks for up to 5 minutes and may 504 at the gateway’s wait ceiling. For flex work, use the Responses API with background=true, which returns a queued response you poll for later.

Claude Agent SDK

The Claude Agent SDK runs the Claude Code agent loop as a library. Because the SDK owns the request body, set the completion window through the X-Valar-Completion-Window header via ANTHROPIC_CUSTOM_HEADERS rather than body metadata.
ANTHROPIC_API_KEY sends x-api-key, which Valar accepts. allowed_tools enables the SDK’s built-in tools (Read, Grep, Bash, …) or your own MCP servers — leave it empty for a plain completion.

Next steps

Inference modes

Realtime, async, and completion windows.

API support matrix

What /v1/messages accepts and returns.