Skip to main content
POST
/
chat
/
completions
对话完成接口
curl --request POST \
  --url https://geekai.co/api/v1/chat/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "gpt-5-mini",
  "messages": [
    {
      "content": "你是一个助手",
      "role": "system"
    },
    {
      "content": "你好",
      "role": "user"
    }
  ],
  "enable_thinking": false,
  "thinking": {
    "include_thoughts": false,
    "budget_tokens": 16000,
    "reasoning_effort": "medium",
    "thinking_level": "high"
  },
  "stream": false,
  "background": false,
  "enable_search": false,
  "search_config": {
    "engine": "glm/search-std",
    "prompt": "<string>",
    "intent": false,
    "count": 10,
    "domain_filter": "<string>",
    "recency_filter": "noLimit",
    "content_size": "medium",
    "return_result": false,
    "result_sequence": "after",
    "require_search": false,
    "deepable": false
  },
  "enable_url_context": false,
  "temperature": 123,
  "max_completion_tokens": 4096,
  "json_mode": false,
  "response_format": {
    "type": "text"
  },
  "modalities": [
    "text"
  ],
  "audio": {
    "voice": "alloy",
    "format": "wav"
  },
  "image": {
    "aspect_ratio": "1:1",
    "image_size": "1K"
  },
  "tools": "<array>",
  "tool_choice": "none",
  "tool_config": {
    "functionCallingConfig": {
      "mode": "AUTO",
      "allowedFunctionNames": [
        "<string>"
      ]
    }
  },
  "parallel_tool_calls": true,
  "image_generation": false,
  "stop": [
    "<string>"
  ],
  "logprobs": false,
  "top_logprobs": 2,
  "frequency_penalty": 0,
  "presence_penalty": 0,
  "top_p": 1,
  "top_k": 1,
  "seed": 123,
  "n": 1,
  "metadata": {},
  "sess_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "retries": 0
}
'
{
  "id": "<string>",
  "status": "pending",
  "created": 123,
  "model": "<string>",
  "object": "<string>",
  "choices": [
    {
      "index": 123,
      "message": {
        "role": "assistant",
        "content": "<string>",
        "reasoning_content": "<string>",
        "image": "<string>",
        "audio": {
          "id": "<string>",
          "data": "<string>",
          "expires_at": 123,
          "transcript": "<string>"
        },
        "tool_calls": [
          {
            "id": "<string>",
            "type": "function",
            "function": {
              "name": "<string>",
              "arguments": "<string>"
            }
          }
        ]
      },
      "finish_reason": "stop",
      "logprobs": {
        "content": [
          {
            "token": "<string>",
            "logprob": 123,
            "bytes": [
              123
            ],
            "top_logprobs": [
              {
                "token": "<string>",
                "logprob": 123,
                "bytes": [
                  123
                ]
              }
            ]
          }
        ]
      }
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123,
    "billed_units": 123,
    "prompt_tokens_details": {
      "text_tokens": 123,
      "audio_tokens": 123,
      "cached_tokens": 123,
      "image_tokens": 123,
      "video_tokens": 123,
      "citation_tokens": 123
    },
    "completion_tokens_details": {
      "text_tokens": 123,
      "audio_tokens": 123,
      "reasoning_tokens": 123,
      "accepted_prediction_tokens": 123,
      "rejected_prediction_tokens": 123
    }
  },
  "citations": [
    "<string>"
  ],
  "system_fingerprint": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.geekai.co/llms.txt

Use this file to discover all available pages before exploring further.

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.
The response data structure is fully compatible with OpenAI and builds upon it to add new features for adapting to other models. It provides support for cited links (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

curl --location --request POST 'https://geekai.dev/api/v1/chat/completions' \
--header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gpt-4o-mini",
    "messages": [
        {
            "role": "user",
            "content": "hi"
        }
    ],
    "stream": false
}'

Authorizations

Authorization
string
header
required

API认证token

Body

application/json
model
string
default:gpt-5-mini
required

对话模型

messages
object[]
required

消息列表

Example:
[
{ "content": "你是一个助手", "role": "system" },
{ "content": "你好", "role": "user" }
]
enable_thinking
boolean
default:false

开启推理模式,仅支持切换思考模式的模型支持

thinking
object

推理模式细节配置

stream
boolean
default:false

是否返回流式响应,默认false

background
boolean
default:false

是否开启后台任务模式,默认false,注意 stream 和 background 不能同时为 true

是否启用联网搜索,默认false

search_config
object

联网搜索配置明细,仅智谱清言和不支持内置搜索工具的模型适用

enable_url_context
boolean
default:false

是否启用 URL Context,默认false,仅部分 Gemini 模型生效

temperature
number

温度参数,默认为代理模型默认值

max_completion_tokens
integer

最大输出token数,默认设置为当前模型最大支持输出

Example:

4096

json_mode
boolean
default:false

是否设置响应格式为JSON对象,默认false

response_format
Text · object

指定响应输出格式,默认不指定为文本输出,如果设置该配置项会覆盖json_mode设置

modalities
enum<string>[]

输出的多模态类型列表

Available options:
text,
image,
audio,
video
audio
object

音频输出配置

image
object

图像生成配置,仅 Gemini 3 Pro Image 适用

tools
array

可调用的工具函数列表

tool_choice

模型在生成响应时应如何选择使用哪个工具(或多个工具)

Available options:
none,
auto,
required
tool_config
object

工具函数调用配置(兼容gemini)

parallel_tool_calls
boolean
default:true

是否并发调用工具函数

image_generation
boolean
default:false

是否强制出图,仅支持对话画图的模型支持

stop
string[]

停止生成的触发词列表

logprobs
boolean
default:false

是否返回token概率

top_logprobs
integer

每个位置返回的最可能token数

Example:

2

frequency_penalty
number
default:0

频率惩罚系数

presence_penalty
number
default:0

存在惩罚系数

top_p
number
default:1

核采样阈值

top_k
integer
default:1

最高概率采样数

seed
integer

随机数种子

n
integer
default:1

生成结果数量

metadata
object

自定义元数据

sess_id
string<uuid>

第三方应用自行实现的会话ID

retries
integer
default:0

自动重试次数,默认0

Response

成功响应

id
string

请求ID

status
enum<string>

请求状态,只有后台模式才会返回

Available options:
pending,
running,
succeed
created
integer

请求创建Unix时间戳

model
string

对话使用的模型

object
string

响应对象类型

choices
object[]

生成的对话列表

usage
object

tokens消耗统计

citations
string[]

引用的文献/链接列表

system_fingerprint
string

系统指纹