Coze 智能体转 OpenAI API
将 Coze Bot 无缝转换为 OpenAI 兼容的 API 接口,支持文本和图像输入,轻松集成到现有应用
OpenAI 兼容
完全兼容 OpenAI API 格式,无需修改现有代码即可切换
Bot 映射
将 Coze Bot 映射为自定义模型名称,灵活管理多个智能体
Key 管理
创建和管理多个 API Key,支持速率限制和访问控制
日志追踪
完整的请求日志记录,方便调试和使用分析
快速开始
使用 OpenAI SDK 调用 API
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://your-domain.com/api/v1',
apiKey: 'sk-coze-your-api-key',
});
const response = await client.chat.completions.create({
model: 'your-model-id',
messages: [{ role: 'user', content: 'Hello!' }],
stream: true,
});
for await (const chunk of response) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}