Documentation Index
Fetch the complete documentation index at: https://metrion.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Use Metrion as a drop-in proxy for Anthropic’s API. Your requests pass through https://www.metrion.dev/api/proxy, Metrion logs the usage, and the response comes back unchanged.
Prerequisites
- A Metrion account with your
sk-metrion-xxx token (find it on the Integrate page)
- An Anthropic API key saved in Metrion’s Integrate page
Setup
Install the Anthropic SDK
npm install @anthropic-ai/sdk
Replace the default Anthropic base URL with Metrion’s proxy and use your sk-metrion-xxx token as the API key. The SDK automatically appends /v1/messages to the baseURL.
import Anthropic from '@anthropic-ai/sdk'
const client = new Anthropic({
apiKey: 'sk-metrion-xxx', // your Metrion token
baseURL: 'https://www.metrion.dev/api/proxy',
})
import anthropic
client = anthropic.Anthropic(
api_key="sk-metrion-xxx", # your Metrion token
base_url="https://www.metrion.dev/api/proxy",
)
import Anthropic from '@anthropic-ai/sdk'
const client = new Anthropic({
apiKey: 'sk-metrion-xxx',
baseURL: 'https://www.metrion.dev/api/proxy',
})
const message = await client.messages.create({
model: 'claude-sonnet-4-6',
max_tokens: 1024,
messages: [{ role: 'user', content: 'Hello, world!' }],
})
console.log(message.content)
import anthropic
client = anthropic.Anthropic(
api_key="sk-metrion-xxx",
base_url="https://www.metrion.dev/api/proxy",
)
message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, world!"}],
)
print(message.content)
Direct HTTP
If you prefer to call the API without a SDK, POST directly to the messages endpoint:
curl https://www.metrion.dev/api/proxy/messages \
-H 'x-api-key: sk-metrion-xxx' \
-H 'anthropic-version: 2023-06-01' \
-H 'content-type: application/json' \
-d '{
"model": "claude-sonnet-4-6",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello, world!"}]
}'
Supported models
| Model ID | Display name |
|---|
claude-opus-4-6 | Claude Opus 4 |
claude-sonnet-4-6 | Claude Sonnet 4 |
claude-haiku-4-5-20251001 | Claude Haiku 4 |
Metrion uses prefix matching, so versioned model IDs (e.g. claude-opus-4-6) are automatically mapped to the correct pricing tier.
Pass-through mode
If you want to manage your Anthropic key yourself instead of storing it in Metrion, use pass-through mode. Pass your Anthropic key in x-api-key and your Metrion token in x-metrion-token:
import Anthropic from '@anthropic-ai/sdk'
const client = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY, // your Anthropic key directly
baseURL: 'https://www.metrion.dev/api/proxy',
defaultHeaders: {
'x-metrion-token': 'sk-metrion-xxx', // identifies your Metrion account
},
})
In pass-through mode, your Anthropic key is forwarded directly to Anthropic’s API and is never stored by Metrion.
Track requests by user or service
Add the optional x-metrion-user header to tag individual requests with a user ID, agent name, or service label. These labels appear in your Metrion logs and dashboards.
Use x-metrion-user to break down costs by team member, bot, or application — for example "x-metrion-user": "agent-summarizer" or "x-metrion-user": "user-42".
const client = new Anthropic({
apiKey: 'sk-metrion-xxx',
baseURL: 'https://www.metrion.dev/api/proxy',
defaultHeaders: {
'x-metrion-user': 'user-42',
},
})