install ยท Anthropic Python / TS SDK

Wire Anthropic Python / TS SDK into AdToken

Direct programmatic use of Claude in Python or TypeScript.

1
Install AdToken
curl -fsSL https://limitlesstokens.com/install.sh | sh
adtoken init
2
Watch one ad
adtoken earn
3
Point the SDK at AdToken
Run eval "$(adtoken env)" for the current shell, then use the provider env vars the SDK already understands:
import os
from anthropic import Anthropic

client = Anthropic(
    base_url=os.environ["ANTHROPIC_BASE_URL"],
    api_key=os.environ["ANTHROPIC_API_KEY"],
)
resp = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=512,
    messages=[{"role": "user", "content": "hi"}],
)
print(resp.content[0].text)
4
TypeScript variant
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: process.env.ANTHROPIC_BASE_URL,
  apiKey: process.env.ANTHROPIC_API_KEY,
});
Need the upstream documentation for Anthropic Python / TS SDK? https://docs.anthropic.com/en/api/client-sdks โ†—

โ† back to all tools