Use the Anthropic Claude API from your app without shipping the key

Guide · Full API reference

Shipping a provider key inside a mobile or frontend app means anyone can extract it from the binary. MyAppToken is a reverse proxy that keeps your Anthropic Claude key server-side: your app swaps the base URL, authenticates users with a short-lived JWT, and the proxy injects the key on the way to the provider. The proxy injects your Anthropic key as x-api-key — your app never carries it. Vision and PDF inputs pass through binary-safe.

1. Point a service at Anthropic Claude

In the dashboard, create an app and add a service:

claude  →  https://api.anthropic.com

No /v1 at the end: the official Anthropic SDKs add /v1/messages themselves, so this base URL works for raw HTTP and SDKs alike.

Paste your Anthropic Claude key into the service's token vault — it is stored encrypted, masked from then on, and rotatable without an app release.

2. Get a per-user JWT

JWT=$(curl -s -X POST https://api.myapptoken.com/api/v1/auth/simple \
  -H 'Content-Type: application/json' \
  -d '{"app_id": "<app-id>", "user_id": "user-123"}' | jq -r .access_token)

3. Call Anthropic Claude through the proxy

Auth injection: Claude's x-api-key header scheme is built in, and anthropic-version is defaulted to 2023-06-01 if your app doesn't send one.

curl https://api.myapptoken.com/api/v1/proxy/<app-id>/claude/v1/messages \
  -H "Authorization: Bearer $JWT" \
  -H 'Content-Type: application/json' \
  -d '{"model": "claude-sonnet-5", "max_tokens": 256, "messages": [{"role": "user", "content": "Hello"}]}'

With the official Anthropic SDK the whole change is the base URL and the credential. Pass the JWT as authToken (sent as Authorization: Bearer), not as apiKey:

// TypeScript / React Native — before
const claude = new Anthropic({ apiKey: "<provider key shipped in the app>" });

// after
const claude = new Anthropic({
  authToken: sessionJWT,            // from /auth/simple, expires in 1 h
  apiKey: null,
  baseURL: "https://api.myapptoken.com/api/v1/proxy/<app-id>/claude",
});

Kotlin, Swift, Flutter and Python versions, plus token renewal, are in the docs: Use the OpenAI and Anthropic SDKs.

What you get on top

Start free — no credit card; the Free plan covers 10,000 requests a month. Full details in the docs.

Further reading