Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
使用 Anthropic Messages API 协议调用 Claude 模型
POST /v1/messages
curl -X POST "https://xuwuai.com/v1/messages" \ -H "Authorization: Bearer $TOKEN" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d '{ "model": "claude-opus-4-6", "max_tokens": 1024, "messages": [ {"role": "user", "content": "你好,请用一句话自我介绍。"} ] }'
pip install anthropic
import os import anthropic client = anthropic.Anthropic( api_key=os.environ["TOKEN"], base_url="https://xuwuai.com", ) message = client.messages.create( model="claude-opus-4-6", max_tokens=1024, messages=[{"role": "user", "content": "你好,请用一句话自我介绍。"}], ) print(message)
npm install @anthropic-ai/sdk
import Anthropic from "@anthropic-ai/sdk"; const client = new Anthropic({ apiKey: process.env.TOKEN!, baseURL: "https://xuwuai.com", }); const message = await client.messages.create({ model: "claude-opus-4-6", max_tokens: 1024, messages: [{ role: "user", content: "你好,请用一句话自我介绍。" }], }); console.log(message);
messages
stop_reason
GET /v1/models