アンスロピック
アンスロピック ↗は、信頼性が高く、解釈可能で、操作可能なAIシステムの構築を支援します。
https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/anthropic
curl https://gateway.ai.cloudflare.com/v1/{account_id}/{gateway_id}/anthropic/v1/messages \ --header 'x-api-key: {anthropic_api_key}' \ --header 'anthropic-version: 2023-06-01' \ --header 'Content-Type: application/json' \ --data '{ "model": "claude-3-opus-20240229", "max_tokens": 1024, "messages": [ {"role": "user", "content": "Cloudflareとは何ですか?"} ] }'@anthropic-ai/sdkを使用している場合、エンドポイントを次のように設定できます:
import Anthropic from "@anthropic-ai/sdk";
const apiKey = env.ANTHROPIC_API_KEY;const accountId = "{account_id}";const gatewayId = "{gateway_id}";const baseURL = `https://gateway.ai.cloudflare.com/v1/${accountId}/${gatewayId}/anthropic`;
const anthropic = new Anthropic({ apiKey, baseURL,});
const model = "claude-3-opus-20240229";const messages = [{ role: "user", content: "Cloudflareとは何ですか?" }];const maxTokens = 1024;
const message = await anthropic.messages.create({ model, messages, max_tokens: maxTokens,});