Skip to content

Migrating from the Anthropic SDK ​

Usefully serves Anthropic's Messages API at /v1/messages. Point the SDK at Usefully:

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

const client = new Anthropic({ baseURL: "https://api.usefully.info", apiKey: process.env.USEFULLY_API_KEY });
const msg = await client.messages.create({
  model: "claude-sonnet-5-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello" }],
});
python
import os
from anthropic import Anthropic

client = Anthropic(base_url="https://api.usefully.info", api_key=os.environ["USEFULLY_API_KEY"])

Requests and responses (including streaming, your own tools, prompt caching and the anthropic-version header) are passed through unchanged, so existing code keeps working. Model names can be bare (claude-sonnet-5-5) or prefixed (anthropic/claude-sonnet-5-5).

Not available yet (the request fails with 400 unsupported_feature, and you aren't charged):

  • anthropic-beta headers.
  • Anthropic's server tools: web search, web fetch, code execution and MCP connectors. For web search, use /v1/search and pass the results to the model.
  • Prompt caching longer than 5 minutes ("ttl": "1h").

Requests always run on standard capacity (service_tier is set to standard_only).

To call non-Claude models from the same code, use the OpenAI-compatible /v1/chat/completions endpoint, which serves every model including Claude.