Skip to main content

Quick Start: Anthropic

Run these examples on a server or your local development machine. Keep service and provider keys out of public browser bundles.

1. Choose your region and create a key​

Choose EU or US in the docs region selector. Accounts and keys are separate in each region. Sign up at Register in your chosen region and confirm the verification email; until then key creation and proxy requests return 403 Email Verification Required. Create an active Makas key in API Keys. The full mks_ token is shown once; a preview is only an identifier. If you no longer have the full key, create a replacement and revoke the old key when appropriate.

Your Makas key identifies the regional account; your provider key authenticates and pays the upstream provider. Stored provider keys are disabled for the first launch. The region selector changes displayed and copied URLs together.

2. Prepare your language and send a request​

Choose a language below. Replace the clearly labelled shell placeholders with your own keys on your local machine. These complete examples each make one bounded request; model access depends on your provider account.

Python​

Use Python 3.13. Prepare the runtime and install the pinned SDK:

python --version
python -m pip install anthropic==1.17.0

Set credentials in the same POSIX shell, replacing both placeholders:

export MAKAS_API_KEY='replace-with-your-full-makas-key'
export ANTHROPIC_API_KEY='replace-with-your-provider-key'

Save this complete example as example.py:

Python
import os
from anthropic import Anthropic

# Anthropic SDK adds /v1/messages; do not append /v1 to this base.
client = Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"],
    base_url="https://eu.makas.ai/proxy/anthropic",
    default_headers={"Makas-Api-Key": os.environ["MAKAS_API_KEY"]},
    timeout=30.0, max_retries=0)
raw = client.messages.with_raw_response.create(
    model="claude-haiku-5-5", messages=[{"role": "user", "content": "Say hello"}], max_tokens=64)
response = raw.parse()
print("".join(block.text for block in response.content if block.type == "text"))
print("Routed:", raw.headers.get("Makas-Was-Routed"))

Run it in the same shell:

python example.py

TypeScript​

Use Node 22+. In a working directory, install the pinned runtime and dependencies:

node --version
npm init -y
npm pkg set type=module
npm install @anthropic-ai/sdk@0.135.0 tsx@4.23.15 typescript@7.0.2

Set credentials in the same POSIX shell, replacing both placeholders:

export MAKAS_API_KEY='replace-with-your-full-makas-key'
export ANTHROPIC_API_KEY='replace-with-your-provider-key'

Save this complete example as example.ts:

TypeScript
import Anthropic from "@anthropic-ai/sdk";
// The SDK adds /v1/messages.
const client = new Anthropic({apiKey: process.env.ANTHROPIC_API_KEY,
  baseURL: "https://eu.makas.ai/proxy/anthropic",
  defaultHeaders: {"Makas-Api-Key": process.env.MAKAS_API_KEY!},
  timeout: 30000, maxRetries: 0});
const {data, response} = await client.messages.create({
  model: "claude-haiku-5-5", messages: [{role: "user", content: "Say hello"}], max_tokens: 64,
}).withResponse();
console.log(data.content.filter(block => block.type === "text").map(block => block.text).join(""));
console.log("Routed:", response.headers.get("Makas-Was-Routed"));

Run it in the same shell:

npx tsx example.ts

cURL​

Use a POSIX shell and cURL 7.76+ (for --fail-with-body). Check your installed version:

curl --version

Set credentials in the same shell, replacing both placeholders:

export MAKAS_API_KEY='replace-with-your-full-makas-key'
export ANTHROPIC_API_KEY='replace-with-your-provider-key'

Copy and run this complete request in that shell:

Shell
curl --fail-with-body --silent --show-error --max-time 30 -i "https://eu.makas.ai/proxy/anthropic/v1/messages" \
  -H "Content-Type: application/json" \
  -H "Makas-Api-Key: $MAKAS_API_KEY" \
  -H "X-Api-Key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  --data '{"model":"claude-haiku-5-5","messages":[{"role":"user","content":"Say hello"}],"max_tokens":64}'

Representative response​

This is an illustrative response shape, not an exact generated answer or guaranteed token count. The examples above extract the text from the provider-native structure.

{
"content": [
{
"type": "text",
"text": "Hello!"
}
],
"usage": {
"input_tokens": 12,
"output_tokens": 4
}
}

3. Verify the result in Request Logs​

For buffered inference, inspect the HTTP status and conditional Makas-Was-Routed, Makas-Model-Requested, Makas-Model-Used and Makas-Provider-Used headers. Cost and savings require usage and known pricing; rule and timing fields depend on the path. Missing values are allowed. A successful request may stay on the requested model and save nothing.

Open Request Logs in the same region. The examples print a bounded response and representative metadata; generated text and savings vary. For streams, initial HTTP 200 is not terminal success: wait for completion and check final usage, cost and incomplete outcomes in Request Logs. See response headers.

Troubleshooting​

  • 401: check the full MAKAS_API_KEY, its expiry/revocation, the selected region and exactly one Makas-Api-Key header. A masked preview cannot authenticate.
  • 403 Email Verification Required: confirm the verification email for this regional account, then retry.
  • 400 PROXY_API_KEY_ERROR: supply the matching provider credential in its native header.
  • Provider auth/model error: confirm provider account access, billing and model availability. Local contract tests do not establish live vendor access.
  • 429: branch on the problem errorCode when present, otherwise on type. Burst limits can include Retry-After; exhausted monthly quotas (TOKEN_QUOTA_EXCEEDED, REQUEST_QUOTA_EXCEEDED) and spending caps (type: urn:makas:error:cost-cap-exceeded, no errorCode) need a reset or limit change, not a retry loop.
  • 5xx: inspect status, correlation ID and Request Logs; use bounded retries appropriate to the operation.
  • Success without routing: check enabled groups, tier, confidence, capabilities and conversation continuity. Same-provider routing does not guarantee a model change.

Next steps​

Provider reference · Streaming