Claude Opus 4.8 经济版
Claude Opus 4.8 是 Anthropic 正式发布的最强 Opus 模型,专为复杂推理、长周期智能体编程和高度自主的专业工作流而设计。它支持文本、图像和文件输入,并生成文本输出。该模型拥有 100 万 tokens 的上下文窗口、最多 128,000 个输出 tokens,并内置自适应思考、工具使用和结构化输出能力。它擅长高级编程、浏览器及计算机操作智能体、企业知识工作、金融与法律分析,以及需要持续判断和高可靠性的多步骤任务。
claude-opus-4-8
1 认证
该 API 使用 API Key 进行认证。
获取你的 API Key
从 https://icreat.ai/hub/keys 获取你的 API key。
2 调用 API
该模型提供与 Anthropic 的 /messages API 兼容的 HTTP API。你可以使用任何兼容此 API 的 SDK 来调用该 llm。
2.1 curl
curl --fail-with-body --connect-timeout 10 --max-time 60 \
-X POST https://api.icreat.ai/llm/anthropic/v1/messages \
-H "Authorization: Bearer ${ICREAT_API_KEY}" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-8",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Which is healthier, coffee or tea?"}
],
"stream": false
}'2.2 python
import anthropic
client = anthropic.Anthropic(
base_url="https://api.icreat.ai/llm/anthropic",
api_key="ICREAT_API_KEY"
)
message = client.messages.create(
model="claude-opus-4-8",
system="You are a helpful assistant.",
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "Hi, how are you?"
}
]
}
]
)
for block in message.content:
if block.type == "thinking":
print(f"Thinking:\n{block.thinking}\n")
elif block.type == "text":
print(f"Text:\n{block.text}\n")2.3 node.js
const client = new Anthropic({
baseURL: "https://api.icreat.ai/llm/anthropic"
apiKey: "ICREAT_API_KEY"
});
const message = await client.messages.create({
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, Claude" }],
model: "claude-opus-4-8"
});
for (const block of message.content) {
if (block.type === "text") {
console.log(block.text);
}
}3 API 协议
3.1 流式输出
将 stream 参数设置为 true 以请求流式输出。
{
"model": "claude-opus-4-8",
"messages": [
{
"role": "user",
"content": "Please explain what recursion is and give a Python example."
}
],
"stream": true
}