LiteLLM 为 100 多个 LLM 提供商提供统一的 Python API。CometAPI 原生支持 —— 使用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.
cometapi/ 前缀即可通过 CometAPI 的模型目录路由请求。
前置条件
- Python 3.6+
- 一个拥有有效 API key 的 CometAPI 账户 —— 点此获取
提示与故障排查
提示与故障排查
- 模型格式:CometAPI 模型使用前缀
cometapi/<model-name>,例如cometapi/your-model-id。可用模型请参阅 CometAPI Models 页面。 - 微调(Fine-tuning)响应:LiteLLM 支持
temperature、max_tokens和top_p—— 可将它们添加到任意completion()调用中,例如completion(..., temperature=0.7)。 - 错误处理:使用
try/except包裹调用,以捕获无效 key 错误或网络问题。 - 安全性:切勿将 API key 提交到版本控制中。请使用环境变量或密钥管理器。
- 速率限制:在 CometAPI 控制台中监控用量。
- 更多文档:LiteLLM 文档 —— CometAPI 快速开始