AI 服务/大语言模型
Anthropic 对话
Changed on接口说明:Anthropic Messages API(/v1/messages)的兼容端点,支持流式输出(SSE)。请求、响应与错误格式遵循 Anthropic 规范;鉴权使用 x-api-key 头(Anthropic SDK 默认携带),已有 Anthropic SDK 只需替换 baseURL 与 API Key 即可接入,按 AiToEarn 积分计费。
调用本接口前,请先请求「对话模型列表」接口(GET /api/ai/models/chat),获取当前可用的模型列表。
post/api/ai/v1/messages
Request
- Base URLhttps://aitoearn.cn
- AuthAPI key in header X-Api-Key
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Example request
{
"messages": [
{
"role": "user",
"content": "请用一句话介绍 AiToEarn。"
}
],
"model": "claude-sonnet-5",
"max_tokens": 64
}Response
第三方协议原生响应或 SSE 数据。不使用 AiToEarn 通用响应包裹。
Changes
- breaking
the
//request property type changed from no type tostring - breaking
removed the media type
application/jsonfor the response with the status
- breaking