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

# Anthropic-compatible API

> Use Claude Code, openclaw, and any Anthropic SDK with AdSkull by changing ANTHROPIC_BASE_URL.

AdSkull exposes a façade at `https://api.adskull.io/anthropic/v1` that speaks
the Anthropic Messages API. Tools written against Anthropic SDKs work by just
changing the base URL and key.

```
ANTHROPIC_BASE_URL = https://api.adskull.io/anthropic/v1
ANTHROPIC_API_KEY  = sk_live_...
```

Both `x-api-key: sk_live_...` and `Authorization: Bearer sk_live_...` are
accepted.

## Endpoint

`POST /anthropic/v1/messages`

## Claude Code (CLI)

```bash theme={"theme":"github-dark"}
export ANTHROPIC_BASE_URL="https://api.adskull.io/anthropic/v1"
export ANTHROPIC_API_KEY="sk_live_..."
claude --model claude-opus-4.7
```

## openclaw

```bash theme={"theme":"github-dark"}
export ANTHROPIC_API_URL="https://api.adskull.io/anthropic/v1"
export ANTHROPIC_API_KEY="sk_live_..."
openclaw chat --model claude-opus-4.7
```

## Anthropic Python SDK

```python theme={"theme":"github-dark"}
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.adskull.io/anthropic/v1",
    api_key="sk_live_...",
)
msg = client.messages.create(
    model="claude-opus-4.7",
    max_tokens=512,
    messages=[{"role": "user", "content": "Hi"}],
)
print(msg.content[0].text)
print(msg.usage.millicredits_charged)  # AdSkull extension
```

## LangChain (Anthropic)

```python theme={"theme":"github-dark"}
from langchain_anthropic import ChatAnthropic

llm = ChatAnthropic(
    anthropic_api_url="https://api.adskull.io/anthropic/v1",
    anthropic_api_key="sk_live_...",
    model="claude-opus-4.7",
)
```

## Model IDs

You may pass either the canonical AdSkull ID or its hyphenated alias:

| Pass any of these                                            | We route to       |
| ------------------------------------------------------------ | ----------------- |
| `claude-opus-4.7`, `claude-opus-4-7`, `claude-4.7`           | Claude Opus 4.7   |
| `claude-opus-4.6`, `claude-opus-4-6`, `claude-4.6`           | Claude Opus 4.6   |
| `claude-sonnet-4.6`, `claude-sonnet-4-6`, `claude-sonnet-46` | Claude Sonnet 4.6 |
| `gemini-3-pro`, `gemini-3.0-pro`                             | Gemini 3 Pro      |

If you pass a real Anthropic model name (e.g. `claude-3-opus-20240229`) we
return `400 invalid_request`. AdSkull controls the underlying provider for
each AdSkull model ID.

## Streaming

`"stream": true` emits Anthropic-style SSE events: `message_start`,
`content_block_start`, `content_block_delta`, `content_block_stop`,
`message_delta`, `message_stop`. The final `message_delta` includes our
`usage.millicredits_charged` and `usage.credits_charged` extensions.

## What's different from real Anthropic

* `model` accepts AdSkull IDs only.
* `usage` includes `millicredits_charged` and `credits_charged` extensions.
* `anthropic-version` is accepted but ignored.
* Beta headers like `anthropic-beta` are ignored.
* All errors use the AdSkull error envelope: `{"error": {"code", "message"}}`.
