prxy.monster API-key BYOK is live. Start free

Using prxy.monster with the Anthropic SDK

prxy.monster speaks the Anthropic Messages shape at https://api.prxy.monster: /v1/messages, Anthropic-style request/response bodies, and Anthropic-style SSE streaming. Set one env var and Messages calls from @anthropic-ai/sdk or anthropic Python route through prxy.monster.

Install

npm install @anthropic-ai/sdk
# or
pip install anthropic

Configure

export ANTHROPIC_BASE_URL=https://api.prxy.monster
export ANTHROPIC_API_KEY=prxy_live_xxxxxxxxxxxxxxxxxxxxxxxx

Anthropic SDK uses ANTHROPIC_BASE_URL (no /v1 suffix). The OpenAI SDK uses OPENAI_BASE_URL with a /v1 suffix. Don’t mix them. Provider-specific SDKs such as Anthropic Bedrock/Vertex variants are not drop-in for this route.

Code change

None.

// Before AND after — no diff
import Anthropic from '@anthropic-ai/sdk';
 
const client = new Anthropic(); // reads env
 
const msg = await client.messages.create({
  model: 'claude-sonnet-4-6',
  max_tokens: 256,
  messages: [{ role: 'user', content: 'hi' }],
});

If you prefer explicit:

const client = new Anthropic({
  baseURL: 'https://api.prxy.monster',
  apiKey: process.env.ANTHROPIC_API_KEY,
});

Verify

curl https://api.prxy.monster/health

Or:

prxy doctor

What you get

For long-running Claude apps or coding agents:

PRXY_PIPE=mcp-optimizer,semantic-cache,patterns,ipc

For Claude Code specifically, add the compaction bridge:

PRXY_PIPE=mcp-optimizer,compaction-bridge,rehydrator,semantic-cache,patterns,ipc

Streaming

Anthropic’s per-block SSE format passes through unchanged — message_start, content_block_start, content_block_delta, message_stop all flow exactly as Anthropic emits them.

const stream = client.messages.stream({
  model: 'claude-sonnet-4-6',
  max_tokens: 1024,
  messages: [{ role: 'user', content: 'write a haiku' }],
});
 
for await (const event of stream) {
  if (event.type === 'content_block_delta' && event.delta.type === 'text_delta') {
    process.stdout.write(event.delta.text);
  }
}

Cache hits are replayed as synthetic Anthropic SSE so your stream parser doesn’t notice the difference.

Common issues

Full example

Plain Node script: github.com/Ekkos-Technologies-Inc/prxy-monster-examples/tree/main/examples/anthropic-quickstart