Guide
Switch from the OpenAI or Anthropic SDK in two lines
Usefully speaks the OpenAI and Anthropic APIs, so moving an app over is a base URL and a key. Here's exactly what changes.
· 1 min read · Usefully team
If your app already uses the OpenAI or Anthropic SDK, you don't need a new client. Point the SDK at Usefully, use your Usefully key, and pick a model by its Usefully ID.
OpenAI SDK
from openai import OpenAI
client = OpenAI(
base_url="https://api.usefully.info/v1", # was: the OpenAI default
api_key=USEFULLY_API_KEY, # was: OPENAI_API_KEY
)
reply = client.chat.completions.create(
model="anthropic/claude-sonnet-5-5",
messages=[{"role": "user", "content": "Hello!"}],
)Streaming, tool calling and images work the same way. Many tools that use the OpenAI SDK also read the OPENAI_BASE_URL and OPENAI_API_KEY environment variables, so you can often switch without touching code.
Anthropic SDK
The Anthropic SDKs add /v1/messages themselves, so the base URL has no /v1:
import anthropic
client = anthropic.Anthropic(base_url="https://api.usefully.info", api_key=USEFULLY_API_KEY)
reply = client.messages.create(
model="anthropic/claude-sonnet-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)Model IDs
Models are named <author>/<model>, like anthropic/claude-sonnet-5-5. A bare name also works when it matches exactly one model. The models page lists every ID with its price and context window.
What you get on top
- One key and one balance for every provider, plus web search.
- Automatic fallback to another provider serving the same model when one fails.
- Logs and usage with the cost of every request.
- Spend controls: per-key rate and daily spend limits, and low-balance alerts.
Some Anthropic beta features aren't priced on Usefully yet and are refused with 400 unsupported_feature rather than billed incorrectly. The Anthropic migration guide lists them.