API key

API reference

Your own Anthropic key

Call Anthropic's models through Paranine with your own Anthropic key, billed to your Anthropic account.

Store your Anthropic API key with Paranine, then call Anthropic's Messages API through Paranine with your Paranine key. Requests run under your Anthropic account and appear on Anthropic's bill, with Paranine's key limits and request logs around them. This is called bring your own key (BYOK).

Store your key

Requires a signed-in session; see Account API. You can also do this in the dashboard, under Organization settings → BYOK.

POST /api/vault/keys
{"provider": "anthropic", "api_key": "sk-ant-…"}
{"status": "success", "provider": "anthropic", "key_suffix": "ey-value", "is_active": true}

Storing a key again replaces the previous one, so rotating it is a single call. The key is encrypted at rest and is never shown again, by any endpoint or in the dashboard: only its last 8 characters (key_suffix), so you can tell which key is loaded. If you lose it, rotate it with Anthropic and store the new one.

  • GET /api/vault/keys lists your stored keys by provider, with their suffix.
  • DELETE /api/vault/keys/anthropic removes your key.

Changes take effect within seconds.

Call Anthropic

Anthropic's Messages API is at POST /v1/messages on the same host, with your Paranine key and Anthropic's own model ids:

export P9_BASE_URL=https://sovereign.paranine.com
export P9_API_KEY=your_paranine_key

curl "$P9_BASE_URL/v1/messages" \
  -H "Authorization: Bearer $P9_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 200,
    "messages": [{ "role": "user", "content": "Hello" }],
    "stream": true
  }'

Anthropic's SDKs work with only the client changed. Point base_url at the host itself, not /v1: these SDKs add /v1/messages themselves.

import os
import anthropic

client = anthropic.Anthropic(
    base_url=os.environ["P9_BASE_URL"],
    api_key=os.environ["P9_API_KEY"],
)

with client.messages.stream(
    model="claude-sonnet-5",
    max_tokens=200,
    messages=[{"role": "user", "content": "Hello"}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

In Node.js it's the same two settings: new Anthropic({ baseURL: process.env.P9_BASE_URL, apiKey: process.env.P9_API_KEY }).

The SDKs send the key in an x-api-key header and cURL sends Authorization: Bearer; Paranine accepts either.

Billing

Anthropic bills you for the tokens. Paranine charges a small fee per request, drawn from your balance. These requests are marked in your request logs as served with your own key.

Errors

Without a stored Anthropic key, /v1/messages answers 400 with "BYOK provider key not configured for this organization". Errors on this endpoint use Anthropic's error format, {"type": "error", "error": {"type": "…", "message": "…"}}.

Something unclear or wrong on this page? Tell us. Machine-readable copies: llms.txt.