通过将你的请求格式与其对应的页面匹配,使用 CometAPI 文本模型文档。对于兼容 OpenAI 的聊天,请从 Chat Completions 或 Responses 开始;对于提供商原生格式,请使用对应的提供商页面。Documentation Index
Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt
Use this file to discover all available pages before exploring further.
选择一个文本 API
Chat Completions
使用 messages 数组发送兼容 OpenAI 的聊天消息。
Responses
通过 Responses API 使用推理、多模态输出和内置工具。
Anthropic Messages
使用提供商原生字段调用兼容 Claude 的 Messages 工作流。
Gemini content generation
发送 Gemini 原生内容生成请求。
调用文本模型
从 Models page 或 model directory 中选择任意支持文本的 model ID。下面的示例调用兼容 OpenAI 的 Chat Completions 端点。这些示例使用占位符
your-model-id。在运行请求之前,请将其替换为 Models page 或 model directory 中可用的文本 model ID。响应示例
成功响应可能如下所示。字段值会因模型和请求而异:示例模型记录
这个示例模型目录响应展示了
/api/models 包装结构和一个文本模型记录的形状。它不是完整的模型列表。cURL
常见错误
Missing or invalid API key
Missing or invalid API key
发送
Authorization: Bearer $COMETAPI_KEY。Wrong base URL
Wrong base URL
对于兼容 OpenAI 的请求,请使用
https://api.cometapi.com/v1。Wrong model type
Wrong model type
从 Models page 中选择一个支持文本的模型。
Provider-specific parameter error
Provider-specific parameter error
先移除可选字段,然后一次添加一个字段。
错误代码和重试策略
400
400
在修复请求体之前不要重试。
401
401
在 API key 存在且有效之前不要重试。
404
404
重试前检查 base URL、路径和 model ID。
429
429
使用指数退避重试,并降低并发。
500 or 503
500 or 503
对于临时性的提供商或服务错误,使用退避重试。
定价和模型目录
Models page
了解 CometAPI 如何在文档中公开 model ID。
Model directory
浏览模型可用性和能力。
Pricing
在调用模型之前查看定价。