---
description: "Use Anthropic SDKs and tools with Verda Inference: base URL, the Messages API, the model list, token counting, streaming, thinking, tool use and error codes."
revision_date: 19.11.2026
---

# Anthropic Compatibility

Verda Inference speaks the Anthropic Messages API. Anthropic SDKs and tools work with Verda once you change two settings:

| Setting | Value |
|---------|-------|
| Base URL | `https://inference.verda.com` |
| API key | Your [inference API key](https://docs.verda.com/account/account-and-access/api-credentials/#inference-api-keys) |

The base URL has no `/v1` at the end: Anthropic SDKs add the path themselves. If you set `ANTHROPIC_BASE_URL` and `ANTHROPIC_API_KEY` in your environment, the SDKs pick them up without code changes.

Send the key the way Anthropic clients do, in the `x-api-key` header. `Authorization: Bearer <your key>` works as well. The `anthropic-version` header is optional for messages. The [model list](#models) needs it.

## Make a call

The examples call [Kimi K3.1 Pro](https://docs.verda.com/inference/models/kimi-k3-1-pro/). To call another model, change `model` to its [model ID](https://docs.verda.com/inference/models/#model-ids).

=== "cURL"

    ```bash
    curl -X POST "https://inference.verda.com/v1/messages" \
      -H "x-api-key: <your key>" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "kimi-k3-1-pro",
        "max_tokens": 8192,
        "messages": [{"role": "user", "content": "What is the best viewpoint in Helsinki?"}]
      }'
    ```

=== "Anthropic Python"

    Install the SDK with `pip install anthropic`, then run:

    ```python
    import os

    from anthropic import Anthropic

    client = Anthropic(
        base_url=os.environ["VERDA_INFERENCE_BASE_URL"],
        api_key=os.environ["VERDA_INFERENCE_API_KEY"],
    )

    message = client.messages.create(
        model="kimi-k3-1-pro",
        max_tokens=8192,
        messages=[{"role": "user", "content": "What is the best viewpoint in Helsinki?"}],
    )
    for block in message.content:
        if block.type == "text":
            print(block.text)
    print(message.usage)
    ```

=== "Anthropic Node"

    Install the SDK with `npm install @anthropic-ai/sdk`, then run:

    ```javascript
    import Anthropic from "@anthropic-ai/sdk";

    const client = new Anthropic({
      baseURL: process.env.VERDA_INFERENCE_BASE_URL,
      apiKey: process.env.VERDA_INFERENCE_API_KEY,
    });

    const message = await client.messages.create({
      model: "kimi-k3-1-pro",
      max_tokens: 8192,
      messages: [{ role: "user", content: "What is the best viewpoint in Helsinki?" }],
    });
    for (const block of message.content) {
      if (block.type === "text") console.log(block.text);
    }
    console.log(message.usage);
    ```

`VERDA_INFERENCE_BASE_URL` is `https://inference.verda.com`, as in the [Quickstart](https://docs.verda.com/inference/quickstart/#2-set-your-environment).

## Endpoints

Verda Inference serves these Anthropic endpoints:

| Endpoint | What it does |
|----------|--------------|
| `POST /v1/messages` | Generates a message, with and without streaming |
| `POST /v1/messages/count_tokens` | Returns the number of input tokens a request would use, without generating anything |
| `GET /v1/models` | Lists the models your API key can call. See [Models](#models). |
| `GET /v1/models/{model_id}` | Returns one model |

Other Anthropic endpoints, such as message batches, return `404` with the code `endpoint_not_supported`.

## Models

`GET /v1/models` lists the models your API key can call. Send the `anthropic-version` header to get the answer in Anthropic's format. The Anthropic SDKs always send it. Without the header, the same path answers in the OpenAI format. See [Inference Endpoint API](https://docs.verda.com/inference/models/#inference-endpoint-api).

=== "cURL"

    ```bash
    curl "https://inference.verda.com/v1/models" \
      -H "x-api-key: <your key>" \
      -H "anthropic-version: 2023-06-01"
    ```

=== "Anthropic Python"

    ```python
    import os

    from anthropic import Anthropic

    client = Anthropic(
        base_url=os.environ["VERDA_INFERENCE_BASE_URL"],
        api_key=os.environ["VERDA_INFERENCE_API_KEY"],
    )

    for model in client.models.list():
        print(model.id)
    ```

The answer holds the models in `data`, with `has_more`, `first_id` and `last_id` for paging:

```json
{
  "data": [
    {
      "type": "model",
      "id": "kimi-k3-1-pro",
      "display_name": "kimi-k3-1-pro",
      "created_at": "1970-01-01T00:00:00Z"
    }
  ],
  "has_more": false,
  "first_id": "kimi-k3-1-pro",
  "last_id": "kimi-k3-1-pro"
}
```

Verda doesn't know every field of a model:

- `display_name` is the model name.
- `created_at` is always `1970-01-01T00:00:00Z`. It doesn't tell you when the model was released.
- `capabilities`, `max_input_tokens`, `max_tokens`, `line`, `deprecated_at` and `retires_at` are `null`. The example above leaves them out. Each [model page](https://docs.verda.com/inference/models/) lists what the model can do.

Three query parameters page through the list:

| Parameter | What it does |
|-----------|--------------|
| `limit` | How many models to return, from `1` to `1000`. The default is `20`. |
| `after_id` | Returns the models that come after this model ID |
| `before_id` | Returns the models that come before this model ID |

Send `after_id` or `before_id`, not both. `lifecycle[]` is accepted too. Every listed model is `active`.

### Get one model

`GET /v1/models/{model_id}` returns one model, with the same fields as in the list.

=== "cURL"

    ```bash
    curl "https://inference.verda.com/v1/models/kimi-k3-1-pro" \
      -H "x-api-key: <your key>" \
      -H "anthropic-version: 2023-06-01"
    ```

=== "Anthropic Python"

    ```python
    model = client.models.retrieve("kimi-k3-1-pro")
    print(model.id, model.display_name)
    ```

If the model doesn't exist, or your API key can't call it, you get `404` with `error.type` `not_found_error`.

### Model IDs for Claude Code

Claude Code and the Claude desktop app only show models whose ID looks like one of Anthropic's. Send the header `x-maas-model-namespace: anthropic` to get IDs they keep:

```bash
curl "https://inference.verda.com/v1/models" \
  -H "x-api-key: <your key>" \
  -H "anthropic-version: 2023-06-01" \
  -H "x-maas-model-namespace: anthropic"
```

Each model is then listed as `anthropic/` followed by its model ID written backwards, with the plain model ID as `display_name`. Kimi K3.1 Pro is `anthropic/orp-1-3k-imik`, shown as `kimi-k3-1-pro`. The ID is written backwards because the desktop app also hides IDs that name another model maker.

Requests that carry the header accept both forms as `model`: the listed ID and the plain model ID. Usage and billing are the plain model's. Any other value of the header is rejected with `400`.

You only need this for the model picker. See [Claude Code](https://docs.verda.com/inference/coding-agents/#claude-code) for the setup.

## Request parameters

You can send the usual Messages parameters, including `model`, `max_tokens`, `messages`, `system`, `stop_sequences`, `stream`, `tools`, `tool_choice`, `thinking`, `metadata` and `output_config`. Tool use and structured output work on models that list them under features on their model page.

A few things work differently:

- Tools are the ones you define. Server tools that Anthropic runs for you, such as web search or code execution, are rejected with `400`. So is `mcp_servers`.
- `cache_control` is accepted and has no effect. Prompt caching is automatic: `usage.cache_read_input_tokens` reports the input tokens read from the cache.
- Other parameters the API doesn't support are ignored.

## Streaming

Set `"stream": true` to receive the response as server-sent events. The events follow the Anthropic order: `message_start`, then `content_block_start`, `content_block_delta` and `content_block_stop` for each content block, then `message_delta` and `message_stop`. `message_delta` carries the stop reason and the final `usage`. No `ping` events are sent.

The same [timeouts](https://docs.verda.com/inference/openai-compatibility/#timeouts) apply as for the OpenAI endpoints: stream long generations.

## Thinking

Reasoning models think before they answer. Their thinking comes back as `thinking` content blocks, before the `text` blocks that hold the answer. Thinking counts as output tokens and is billed like them.

The `thinking` field of the request controls it:

- `{"type": "enabled", "budget_tokens": 2048}` turns thinking on.
- `{"type": "disabled"}` turns it off, on models where reasoning is optional.
- Without the field, the model's default applies. A reasoning model then thinks, and its answer includes `thinking` blocks. This differs from Anthropic's API, where thinking is off unless you enable it.

`max_tokens` caps the thinking and the answer together. If the model uses it all while thinking, the answer has no `text` block and `stop_reason` is `max_tokens`. Raise `max_tokens`, or turn thinking off.

## Errors

Errors use the Anthropic error format, so Anthropic SDKs raise them as usual:

```json
{
  "type": "error",
  "error": {"type": "not_found_error", "code": "model_not_found", "message": "model \"example\" not found"},
  "request_id": "01a1e8da-cbbb-7117-a338-8c3cf4a2479a"
}
```

`error.type` is Anthropic's name for the status. `error.code` is the same code the [OpenAI endpoints](https://docs.verda.com/inference/openai-compatibility/#errors) return, and the same table says what to do about each. The `request-id` response header carries the request ID.

| Status | `error.type` |
|--------|--------------|
| `400` | `invalid_request_error` |
| `401` | `authentication_error` |
| `402` | `billing_error` |
| `403` | `permission_error` |
| `404` | `not_found_error` |
| `413` | `request_too_large` |
| `429` | `rate_limit_error` |
| `503`, `529` | `overloaded_error` |
| `504` | `timeout_error` |
| Other `5xx` | `api_error` |
