对话完成接口
Chat
Chat Completions
POST
对话完成接口
Note: For setting the chat model name, refer to System Supported Chat Model List. The request/response parameter structure is fully compatible with OpenAI. When switching models, you only need to modify the corresponding model name. If the model request/response parameters are inconsistent with OpenAI, GeekAI will automatically convert and align them. Except for Baidu ERNIE Bot and iFlytek Spark, all other platforms support function calling (the specific supported models are subject to platform restrictions). When calling the GPTs model API, you need to replace the * in gpt-4-gizmo-* with the corresponding GPTs’ gizmo_id, which can be obtained by extracting it from the GPTs URL. For example, for https://chatgpt.com/g/g-bo0FiWLY7-researchgpt, the corresponding gizmo_id is g-bo0FiWLY7.
citations), search billing units (billed_units), video in message content, image/video input tokens, and inference mode settings (thinking). The response structure changes depending on whether it is a streaming output or not. You can refer to the request examples below to make a judgment:
cURL Request Example
Authorizations
API认证token
Body
application/json
对话模型
消息列表
Example:
[
{ "content": "你是一个助手", "role": "system" },
{ "content": "你好", "role": "user" }
]开启推理模式,仅支持切换思考模式的模型支持
推理模式细节配置
是否返回流式响应,默认false
是否开启后台任务模式,默认false,注意 stream 和 background 不能同时为 true
是否启用联网搜索,默认false
联网搜索配置明细,仅智谱清言和不支持内置搜索工具的模型适用
是否启用 URL Context,默认false,仅部分 Gemini 模型生效
温度参数,默认为代理模型默认值
最大输出token数,默认设置为当前模型最大支持输出
Example:
4096
是否设置响应格式为JSON对象,默认false
指定响应输出格式,默认不指定为文本输出,如果设置该配置项会覆盖json_mode设置
- Text
- JSON object
- JSON schema
输出的多模态类型列表
Available options:
text, image, audio, video 音频输出配置
图像生成配置,仅 Gemini 3 Pro Image 适用
可调用的工具函数列表
模型在生成响应时应如何选择使用哪个工具(或多个工具)
Available options:
none, auto, required 工具函数调用配置(兼容gemini)
是否并发调用工具函数
是否强制出图,仅支持对话画图的模型支持
停止生成的触发词列表
是否返回token概率
每个位置返回的最可能token数
Example:
2
频率惩罚系数
存在惩罚系数
核采样阈值
最高概率采样数
随机数种子
生成结果数量
自定义元数据
第三方应用自行实现的会话ID
自动重试次数,默认0
