Migrating from Anthropic
The ai& Inference API exposes Anthropic-compatible endpoints alongside its OpenAI surface. If you’re using the anthropic SDK, you can migrate by changing the base URL and the API key.
Change two things
Section titled “Change two things”from anthropic import Anthropic
client = Anthropic( base_url="https://api.aiand.com", api_key="sk-your-aiand-api-key",)import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({ baseURL: "https://api.aiand.com", apiKey: "sk-your-aiand-api-key",});The anthropic-version header the SDK sends automatically tells ai& to respond with Anthropic-shape payloads — including on the dual-shape Files endpoints.
Supported endpoints
Section titled “Supported endpoints”| Anthropic endpoint | ai& path | Notes |
|---|---|---|
/v1/messages | Messages | Streaming + tool use + vision |
/v1/files | Files | Anthropic shape selected by anthropic-version header |
What’s different
Section titled “What’s different”- API keys start with
sk-(notsk-ant-) — see Authentication. - Model IDs differ from Anthropic’s. List them via the catalog or
client.models.list()on the OpenAI surface.