Skip to content
Anthropic SDK

Frameworks and SDKs

Use Anthropic SDK with Shannon

Keep the Anthropic SDK: set base_url to Shannon, pass your key, and call Shannon models through the Messages API.

  • Tested Nov 7, 2026
  • Anthropic Messages
  • About 1 min

About Anthropic SDK

The Anthropic SDK is the official client for the Messages API, used by apps and agents built for Claude. Shannon serves the same API at /v1/messages, so code written for the SDK runs on Shannon models after two changes: the base URL and the key. Streaming, tool use and system prompts work the same way.

What you need

A Shannon API key
Keys & usage
Base URL
https://api.shannon-ai.com Endpoint: /v1/messages
Every snippet below follows your choice.

Set it up

  1. Install the SDK

    pip install anthropic
  2. Point it at Shannon and stream

    The base URL has no /v1: the SDK adds /v1/messages itself. max_tokens is required, as with Claude.

    Python
    from anthropic import Anthropic
    
    client = Anthropic(base_url="https://api.shannon-ai.com", api_key="YOUR_API_KEY")
    
    with client.messages.stream(
        model="Kimi-K3-uncensored-NVFP4",
        max_tokens=1024,
        messages=[{"role": "user", "content": "Name three colours a cat can be."}],
    ) as stream:
        for text in stream.text_stream:
            print(text, end="", flush=True)
  3. Call tools

    Tool calls come back as tool_use blocks with stop_reason: "tool_use".

    Python
    r = client.messages.create(
        model="Kimi-K3-uncensored-NVFP4",
        max_tokens=1024,
        tools=[{
            "name": "get_weather",
            "description": "Weather for a city",
            "input_schema": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
        }],
        messages=[{"role": "user", "content": "What is the weather in Oslo?"}],
    )
    print(r.stop_reason)  # tool_use
    print([b.input for b in r.content if b.type == "tool_use"])  # [{'city': 'Oslo'}]

Check that it works

Send: Run the streaming sample.

You should see: The colours printed as they stream in.

Models that fit Anthropic SDK

Every id below meets what Anthropic SDK needs. The first one is the default in the snippets.

Model idContext windowMax outputImage input
Kimi-K3-uncensored-NVFP4 1,022,976 262,144 Yes
Kimi-K3-uncensored-3BIT-REAP 225,280 225,280 Yes
shannon-3 196,608 65,536 Yes
shannon-coder-1 131,072 65,536 No

Good to know

  • base_url is https://api.shannon-ai.com without /v1; with /v1 the SDK calls /v1/v1/messages and gets 404.
  • The SDK sends the key as x-api-key; Shannon also accepts Authorization: Bearer.
  • Use Shannon model ids from GET /v1/models; Claude ids are not served.

Tips

  1. The SDK also reads ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY, so existing code can switch with two environment variables.
  2. Tools built for Claude, such as Claude Code and agents on the Claude Agent SDK, use the same endpoint.
  3. In TypeScript the options are baseURL and apiKey.

Troubleshooting

SymptomCauseFix
404 Not Found base_url ends in /v1. Use https://api.shannon-ai.com.
400 unknown model A Claude model id. Use a Shannon id from GET /v1/models.
401 Unauthorized The key is missing, mistyped or rotated. Copy the key again from Keys & usage; it starts with sk-.
context_length_exceeded / "prompt is too long" The conversation is longer than the model's window. Start a new chat, let the tool compact it, or pick a model with a larger window.
insufficient_quota Your balance cannot pay for the request. Top up or change plan; the request is not retried by itself.

Questions

Does the Anthropic SDK work with Shannon?

Yes. Shannon serves the Messages API at https://api.shannon-ai.com/v1/messages; set base_url to https://api.shannon-ai.com.

Do streaming and tool use work?

Yes, both; we ran a stream and a tool call through the Python SDK.

Choose your language

All languages are equal. Pick the one you want to browse in.

Europe

Middle East & North Africa

South Asia

Southeast Asia

East Asia

Central Asia & Caucasus

Africa

Oceania

Constructed & Classical