OpenAI Chat
OpenAI Chat 接口用于兼容常见的 chat.completions 调用方式。
请求地址
http
POST /v1/chat/completions请求示例
json
{
"model": "gpt-4o-mini",
"messages": [
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "介绍 Cubicspaces 的优势" }
],
"temperature": 0.7,
"stream": false
}响应示例
json
{
"id": "chatcmpl_123",
"object": "chat.completion",
"created": 1770000000,
"model": "gpt-4o-mini",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Cubicspaces 提供统一接口、多模型路由和清晰的集成文档。"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 18,
"completion_tokens": 24,
"total_tokens": 42
}
}常用参数
| 参数 | 类型 | 说明 |
|---|---|---|
model | string | 模型名称 |
messages | array | 对话消息数组 |
temperature | number | 采样温度 |
stream | boolean | 是否流式输出 |
tools | array | 工具调用定义 |