All integrations
🧠

Anthropic SDK

Official Anthropic Python / TypeScript SDK pointed at clawfeeder

Protocol: AnthropicLast verified 2026-05-19

The Anthropic Python and TypeScript SDKs both accept a base_url at client construction. clawfeeder is Anthropic-API-compatible at /v1/messages — point the SDK at https://clawfeeder.ai (no /v1 suffix; the SDK appends /v1/messages itself) and your existing Anthropic code keeps working.

Prerequisites

Python 3.8+ or Node 18+, the anthropic package installed, and a clawfeeder API key.

Steps

1Install the SDK

Both languages publish under the official 'anthropic' namespace.

pip install anthropic
# or:
npm install @anthropic-ai/sdk

2Python: construct the client

Pass base_url and api_key. clawfeeder accepts the same cf-sk-*** in x-api-key (Anthropic SDK default) or Authorization: Bearer.

from anthropic import Anthropic

# IMPORTANT: base_url is the bare host (no /v1).
# The SDK appends "/v1/messages" itself.
client = Anthropic(
    base_url="https://clawfeeder.ai",
    api_key="cf-sk-***your_key***",
)

resp = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=200,
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.content[0].text)

3TypeScript: construct the client

Identical pattern. The SDK handles all the schema validation; you just point it at the gateway.

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

// base URL is the bare host; the SDK appends /v1/messages.
const client = new Anthropic({
  baseURL: "https://clawfeeder.ai",
  apiKey: "cf-sk-***your_key***",
});

const resp = await client.messages.create({
  model: "claude-opus-4-7",
  max_tokens: 200,
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.content[0].type === "text" ? resp.content[0].text : "");

4Streaming

Anthropic SDKs offer a typed stream helper. clawfeeder forwards SSE chunks; iterate as message_stream events.

with client.messages.stream(
    model="claude-opus-4-7",
    max_tokens=300,
    messages=[{"role": "user", "content": "Write a haiku"}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)

Verify

One-liner from a Python shell.

from anthropic import Anthropic; c = Anthropic(base_url="https://clawfeeder.ai", api_key="cf-sk-***"); print(c.messages.create(model="claude-haiku-4-5-20251001", max_tokens=20, messages=[{"role":"user","content":"reply READY"}]).content[0].text)

Expected response includes: READY

FAQ

Tool use — fully supported?

Yes. clawfeeder passes the `tools` parameter through unchanged. Tool result blocks in subsequent messages also flow through. Use the SDK's typed tool helpers as you would against Anthropic direct.

Vision / image inputs?

Yes for vision models (claude-opus-4-7, claude-sonnet-4-6, claude-haiku-4-5-20251001). Use the SDK's image content blocks (base64 or URL); clawfeeder passes them through to the upstream as-is.

Will prompt caching reduce my credits?

cache_control flags are forwarded, and cache_read_input_tokens does flow back in the usage response — but actual cache hit-rate end-to-end through clawfeeder is currently inconsistent. Treat any savings as best-effort, not guaranteed.

Why does anthropic-version header matter?

The Python SDK sets it automatically. If you make raw HTTP calls, include `anthropic-version: 2023-06-01`. clawfeeder forwards this header to the upstream which validates it.

Don't have an API key yet?

Sign up for 300 free credits, 7-day trial, all models

Get started free →
Anthropic SDK × clawfeeder.ai — Integration Guide