Skip to main content
POST
/
v1
/
completions
curl -X POST https://www.geeknow.top/v1/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-3.5-turbo-instruct",
    "prompt": "把下面一句话改写得更正式:这个接口挺好用。",
    "max_tokens": 120,
    "temperature": 0.3
  }'
{
  "id": "cmpl_abc123",
  "object": "text_completion",
  "created": 1735689600,
  "model": "gpt-3.5-turbo-instruct",
  "choices": [
    {
      "index": 0,
      "text": "该接口具备良好的易用性。",
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 22,
    "completion_tokens": 10,
    "total_tokens": 32
  }
}

Documentation Index

Fetch the complete documentation index at: https://mercury-eab3b728.mintlify.app/llms.txt

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

文本补全接口

Legacy Completions 接口使用 prompt 作为输入,适合仍在使用旧 OpenAI SDK 或简单补全文本的业务。新对话场景建议使用 通用对话接口

请求体

model
string
required
模型名称。
prompt
string | array<string>
required
输入提示词。
stream
boolean
是否启用流式输出。
max_tokens
integer
最大生成 token 数。
temperature
number
采样温度。
top_p
number
核采样参数。
stop
string | array<string>
停止序列。

请求示例

curl -X POST https://www.geeknow.top/v1/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-3.5-turbo-instruct",
    "prompt": "把下面一句话改写得更正式:这个接口挺好用。",
    "max_tokens": 120,
    "temperature": 0.3
  }'

响应示例

{
  "id": "cmpl_abc123",
  "object": "text_completion",
  "created": 1735689600,
  "model": "gpt-3.5-turbo-instruct",
  "choices": [
    {
      "index": 0,
      "text": "该接口具备良好的易用性。",
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 22,
    "completion_tokens": 10,
    "total_tokens": 32
  }
}

相关接口