> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prismgateway.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Claude Code

> Point Claude Code and any Anthropic SDK client at Prism

# Claude Code

Prism speaks the Anthropic Messages API natively at `POST /v1/messages`, so
Claude Code and the official Anthropic SDKs work against Prism with three
environment variables and no code changes.

## Claude Code

```bash theme={null}
export ANTHROPIC_BASE_URL=https://api.prism.example.com
export ANTHROPIC_AUTH_TOKEN=sk-prism-your-key
export ANTHROPIC_MODEL=anthropic/claude-opus-5

claude
```

Use the Prism model id, not the bare Anthropic one — `anthropic/claude-opus-5`,
not `claude-opus-5`. Prism resolves it through the catalog, which is what applies
your organization's pricing and model policy.

## Anthropic SDK

<CodeGroup>
  ```ts TypeScript theme={null}
  import Anthropic from "@anthropic-ai/sdk";

  const client = new Anthropic({
    baseURL: "https://api.prism.example.com",
    apiKey: process.env.PRISM_API_KEY,
  });

  const message = await client.messages.create({
    model: "anthropic/claude-opus-5",
    max_tokens: 1024,
    messages: [{ role: "user", content: "Hello" }],
  });
  ```

  ```python Python theme={null}
  import anthropic

  client = anthropic.Anthropic(
      base_url="https://api.prism.example.com",
      api_key=os.environ["PRISM_API_KEY"],
  )

  message = client.messages.create(
      model="anthropic/claude-opus-5",
      max_tokens=1024,
      messages=[{"role": "user", "content": "Hello"}],
  )
  ```

  ```bash curl theme={null}
  curl https://api.prism.example.com/v1/messages \
    -H "x-api-key: $PRISM_API_KEY" \
    -H "anthropic-version: 2023-06-01" \
    -H "content-type: application/json" \
    -d '{
      "model": "anthropic/claude-opus-5",
      "max_tokens": 1024,
      "messages": [{"role": "user", "content": "Hello"}]
    }'
  ```
</CodeGroup>

Both `x-api-key` and `Authorization: Bearer` are accepted, so whichever your
client sends works.

## What is supported

* Non-streaming and streaming (`stream: true`, full Anthropic SSE event sequence)
* `system` as a string or as a list of text blocks
* Text and image content blocks (base64 and URL sources)
* `tools`, `tool_choice`, `tool_use` and `tool_result` — the agent loop works
* `temperature`, `top_p`, `stop_sequences`

`max_tokens` is required, as it is on Anthropic. Prism does not substitute a
default: `max_tokens` is what the credit reservation uses to bound the request,
so a silent default would reserve an amount you never asked for.

## Billing is identical

`/v1/messages` is a translation layer over the same path as
`/v1/chat/completions` — the same authentication, the same credit reservation,
the same metering. A request costs the same through either protocol, and
`x-prism-trace-id` on the response looks the response up in
[usage](/usage) exactly the same way.

## Errors

Errors come back in Anthropic's envelope:

```json theme={null}
{ "type": "error", "error": { "type": "authentication_error", "message": "invalid api key" } }
```

Prism's `402 payment_required` (out of credit) has no Anthropic equivalent and
arrives as `invalid_request_error` with the real reason in the message. Check
[billing](/billing-and-trials) if you see one.

## Not yet supported

Gemini `generateContent` and OpenAI `/v1/responses` are not translated. Prism's
"unified gateway" is about model coverage; protocol coverage today is
OpenAI-compatible plus Anthropic-native.
