Anthropic からの移行
ai& Inference API は OpenAI に加えて Anthropic 互換のエンドポイントも提供しています。anthropic SDK を利用している場合、ベース URL と API キー を変更するだけで移行できます。
2 箇所の変更
Section titled “2 箇所の変更”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",});SDK が自動で送信する anthropic-version ヘッダにより、Files のような共通エンドポイントでも Anthropic 形式のペイロードを返します。
対応エンドポイント
Section titled “対応エンドポイント”| Anthropic エンドポイント | ai& のパス | 備考 |
|---|---|---|
/v1/messages | Messages | ストリーミング + ツール使用 + ビジョン |
/v1/files | Files | anthropic-version ヘッダで Anthropic 形式を選択 |