Integration

Anthropic through the Vigil proxy

Anthropic’s own API for the Claude models, at api.anthropic.com, with explicit prompt caching through cache_control breakpoints. Point your SDK's base URL at Vigil, add one header, and every Anthropic call is logged with its cost, tokens, latency, errors and agent, then forwarded to https://api.anthropic.com unchanged unless you switch on an optimisation. Prompt caching never changes answers. History trimming and model routing can: both are opt-in, run in Shadow first, and stop automatically if errors, cut-off answers or failed answers rise.

What Vigil records per Anthropic call

Each Anthropic call is one record: model id, tokens, cache reads and writes, latency, status, error code and agent. What a record holds, what happens to your Anthropic key and what the hop costs in latency are answered once in the FAQ: what Vigil sees, your provider key and added latency.

Cost is computed from the proxy's rate registry, which prices 17 models on this platform today. A model the registry has no row for is logged with its cost left empty, never estimated.

  • claude-3-5-haiku
  • claude-fable-5
  • claude-fable-5-1
  • claude-fable-5-2
  • claude-haiku-4-5-20251001
  • claude-haiku-5-5
  • claude-opus-4-5
  • claude-opus-4-6
  • claude-opus-4-7
  • claude-opus-4-8
  • claude-opus-5
  • claude-opus-5-5
  • claude-sonnet-4
  • claude-sonnet-4-5
  • claude-sonnet-4-6
  • claude-sonnet-5
  • claude-sonnet-5-5

Price per token, by model: Claude Opus 5, Claude Sonnet 5, Claude Haiku 4.5, Claude Fable 5.1, Claude Sonnet 4.6.

Setup

The Anthropic base URL is https://api.vigil.tools/{user_id}/anthropic; a request path such as /v1/messages is forwarded unchanged, and your Anthropic key stays in ANTHROPIC_API_KEY. The two Vigil headers, the modes and the error codes are the same for every provider: see the LLM proxy setup.

your Anthropic client
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,   // unchanged
  baseURL: "https://api.vigil.tools/{user_id}/anthropic",
  defaultHeaders: {
    // Shown once at creation. Treat it like any other secret.
    "X-Vigil-Key": "vk_your_vigil_key",
    "X-Vigil-Agent": "my-agent",
  },
});

const message = await client.messages.create({
  model: "claude-haiku-4-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello!" }],
});

// Using the Vercel AI SDK instead? Same two changes:
//   import { createAnthropic } from "@ai-sdk/anthropic";
//   const anthropic = createAnthropic({ baseURL: "https://api.vigil.tools/{user_id}/anthropic", headers: { "X-Vigil-Key": "vk_your_vigil_key" } });
your Anthropic client
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.vigil.tools/{user_id}/anthropic",
    default_headers={
        # Shown once at creation. Treat it like any other secret.
        "X-Vigil-Key": "vk_your_vigil_key",
        "X-Vigil-Agent": "my-agent",
    },
)

message = client.messages.create(
    model="claude-haiku-4-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}],
)

# Using LangChain instead? Same two changes:
#   from langchain_anthropic import ChatAnthropic
#   llm = ChatAnthropic(model="claude-haiku-4-5", anthropic_api_url="https://api.vigil.tools/{user_id}/anthropic",
#                       default_headers={"X-Vigil-Key": "vk_your_vigil_key"})
terminal
curl https://api.vigil.tools/{user_id}/anthropic/v1/messages \
  -H "content-type: application/json" \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "X-Vigil-Key: vk_your_vigil_key" \
  -H "X-Vigil-Agent: my-agent" \
  -d '{
    "model": "claude-haiku-4-5",
    "max_tokens": 1024,
    "messages": [{ "role": "user", "content": "Hello!" }]
  }'

Prompt caching on Anthropic

Vigil adds cache breakpoints to your requests — it reads the prompt structure and marks where the reusable prefix ends, so the provider caches exactly that much. This is the mechanism the Optimise page measures and reports savings for.

With optimisation On: Vigil adds cache markers to the stable start of the prompt. In Shadow, Vigil measures what caching would have saved and changes nothing. Off records the call and nothing more.

Questions

Which Anthropic models does Vigil price?
17 models with a published rate in the registry: claude-3-5-haiku, claude-fable-5, claude-fable-5-1, claude-fable-5-2, claude-haiku-4-5-20251001, claude-haiku-5-5, claude-opus-4-5, claude-opus-4-6, claude-opus-4-7, claude-opus-4-8, claude-opus-5, claude-opus-5-5, claude-sonnet-4, claude-sonnet-4-5, claude-sonnet-4-6, claude-sonnet-5, claude-sonnet-5-5. A call to any other Anthropic model is logged and monitored, with its cost left empty rather than guessed.

Other providers: AWS Bedrock · Google Vertex · OpenAI · Google Gemini · Mistral · xAI Grok · DeepSeek · Together AI · Fireworks AI · Groq · Cerebras · Baseten · Moonshot · Z.ai · Cloudflare Workers AI · OpenRouter