Skip to main content
POST
/
v1
/
chat
/
completions
curl -X POST https://www.qingbo.dev/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5",
    "messages": [
      {
        "role": "system",
        "content": "你是一个专业的AI助手。"
      },
      {
        "role": "user",
        "content": "解释一下冒泡排序算法。"
      }
    ],
    "temperature": 0.7,
    "max_tokens": 1024
  }'
{
  "id": "chatcmpl-CdA8u0qPqzeN2gu8QLuQfjaP9CHU4",
  "object": "chat.completion",
  "created": 1763449816,
  "model": "gpt-5-2025-08-07",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "冒泡排序(Bubble Sort)是一种简单的比较交换排序。它通过重复遍历序列,比较相邻元素并把较大的“冒泡”到右侧末端,直到序列有序。\n\n核心思想\n- 每一趟从左到右比较相邻元素,若前者大于后者则交换。一次趟结束后,当前未排部分中最大的元素被放到末尾。\n- 重复多趟,直到没有发生交换或已完成 n−1 趟。\n\n流程示例(以 [5, 1, 4, 2] 为例)\n- 第1趟:比较并交换 → [1, 5, 4, 2] → [1, 4, 5, 2] → [1, 4, 2, 5](最大元素5到末尾)\n- 第2趟:比较并交换 → [1, 4, 2, 5] → [1, 2, 4, 5](已整体有序,可提前结束)\n\n性质\n- 时间复杂度:平均/最坏 O(n^2),最好 O(n)(当已基本有序且使用提前退出优化)\n- 空间复杂度:O(1)(就地排序)\n- 稳定性:稳定(相等元素相对次序不变)\n- 适用场景:数据量小或序列几乎有序;不适合大规模无序数据\n\n常见优化\n- 提前退出:某趟未发生交换则已排序完成。\n- 缩短边界:记录本趟最后一次交换的位置,下一趟只需遍历到该位置。\n- 双向冒泡(鸡尾酒排序):从左到右、再从右到左各走一遍,更快收敛。\n\n简要伪代码\nfunction bubbleSort(a):\n    n = length(a)\n    repeat\n        swapped = false\n        for j = 0 to n-2:\n            if a[j] > a[j+1]:\n                swap(a[j], a[j+1])\n                swapped = true\n        n = n - 1    // 末尾已就位,缩短范围\n    until swapped == false\n\n如需,我可以给出某种语言的实现代码或更多变体说明。",
        "refusal": null,
        "annotations": []
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 1030,
    "total_tokens": 1054,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 512,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.qingbo.dev/llms.txt

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

  • Unified chat API supporting all major text generation models
  • Fully compatible with the OpenAI Chat Completions API format
  • Switch between AI models seamlessly via the model parameter
  • Supports streaming, function calling, and other advanced features
curl -X POST https://www.qingbo.dev/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5",
    "messages": [
      {
        "role": "system",
        "content": "你是一个专业的AI助手。"
      },
      {
        "role": "user",
        "content": "解释一下冒泡排序算法。"
      }
    ],
    "temperature": 0.7,
    "max_tokens": 1024
  }'
{
  "id": "chatcmpl-CdA8u0qPqzeN2gu8QLuQfjaP9CHU4",
  "object": "chat.completion",
  "created": 1763449816,
  "model": "gpt-5-2025-08-07",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "冒泡排序(Bubble Sort)是一种简单的比较交换排序。它通过重复遍历序列,比较相邻元素并把较大的“冒泡”到右侧末端,直到序列有序。\n\n核心思想\n- 每一趟从左到右比较相邻元素,若前者大于后者则交换。一次趟结束后,当前未排部分中最大的元素被放到末尾。\n- 重复多趟,直到没有发生交换或已完成 n−1 趟。\n\n流程示例(以 [5, 1, 4, 2] 为例)\n- 第1趟:比较并交换 → [1, 5, 4, 2] → [1, 4, 5, 2] → [1, 4, 2, 5](最大元素5到末尾)\n- 第2趟:比较并交换 → [1, 4, 2, 5] → [1, 2, 4, 5](已整体有序,可提前结束)\n\n性质\n- 时间复杂度:平均/最坏 O(n^2),最好 O(n)(当已基本有序且使用提前退出优化)\n- 空间复杂度:O(1)(就地排序)\n- 稳定性:稳定(相等元素相对次序不变)\n- 适用场景:数据量小或序列几乎有序;不适合大规模无序数据\n\n常见优化\n- 提前退出:某趟未发生交换则已排序完成。\n- 缩短边界:记录本趟最后一次交换的位置,下一趟只需遍历到该位置。\n- 双向冒泡(鸡尾酒排序):从左到右、再从右到左各走一遍,更快收敛。\n\n简要伪代码\nfunction bubbleSort(a):\n    n = length(a)\n    repeat\n        swapped = false\n        for j = 0 to n-2:\n            if a[j] > a[j+1]:\n                swap(a[j], a[j+1])\n                swapped = true\n        n = n - 1    // 末尾已就位,缩短范围\n    until swapped == false\n\n如需,我可以给出某种语言的实现代码或更多变体说明。",
        "refusal": null,
        "annotations": []
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 1030,
    "total_tokens": 1054,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 512,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  }
}

Authorizations

Authorization
string
required
All endpoints require Bearer Token authentication.Get your API Key:Visit the API Key management page to obtain your API Key.Add it to the request header:
Authorization: Bearer YOUR_API_KEY

Body

model
string
required
Model name.Supported models include:
  • OpenAI: gpt-5, gpt-5-mini, gpt-5-nano, gpt-5.1, gpt-5.2, gpt-5.4, gpt-4.1, gpt-4.1-mini, gpt-4.1-nano, gpt-4o, gpt-4o-mini, o1, o3-mini, o4-mini
  • Anthropic: claude-opus-4.6, claude-sonnet-4.6, claude-opus-4.5, claude-sonnet-4.5, claude-haiku-4.5
  • Google: gemini-2.5-pro, gemini-2.5-flash, gemini-2.5-flash-lite, gemini-3-flash-preview, gemini-3.1-pro-preview
  • DeepSeek: deepseek-r1-0528, deepseek-v3.2, deepseek-v3.2-exp
  • MiniMax: minimax-m2.1, minimax-m2.5
  • MoonshotAI: kimi-k2.5, kimi-k2-thinking
  • Z.ai: glm-4.6, glm-4.7, glm-5, glm-5.1
  • More models added regularly…
messages
array
required
List of conversation messages.
temperature
number
Controls output randomness, range 0–2.
  • Lower values (e.g., 0.2) make output more deterministic.
  • Higher values (e.g., 1.8) make output more random.
Default: 1.0
max_tokens
integer
Maximum number of tokens to generate.The maximum allowed value varies by model — refer to the specific model documentation.
stream
boolean
Whether to use streaming output.
  • true: Stream the response as Server-Sent Events (SSE).
  • false: Return the full response in one go.
Default: false
top_p
number
Nucleus sampling parameter, range 0–1.Controls diversity. We recommend using either temperature or top_p, not both.Default: 1.0
frequency_penalty
number
Frequency penalty, range -2.0 to 2.0.Positive values reduce the likelihood of repeating the same words.Default: 0
presence_penalty
number
Presence penalty, range -2.0 to 2.0.Positive values increase the likelihood of introducing new topics.Default: 0
stop
string or array
Stop sequences.Up to 4 sequences. Generation stops when any of them is encountered.
n
integer
Number of completions to generate.Default: 1

Response

id
string
Unique identifier of the response.
object
string
Object type, always chat.completion.
created
integer
Creation timestamp.
model
string
Name of the model that actually served the request.
choices
array
List of generated completions.
usage
object
Token usage statistics.
system_fingerprint
string
System fingerprint (used to track backend configuration).

Supported Models

OpenAI series

  • gpt-5 — GPT-5 base model
  • gpt-5-mini — GPT-5 lightweight
  • gpt-5-nano — GPT-5 ultra-lightweight
  • gpt-5.1 — GPT-5.1
  • gpt-5.2 — GPT-5.2
  • gpt-5.4 — GPT-5.4
  • gpt-4.1 — GPT-4.1
  • gpt-4.1-mini — GPT-4.1 lightweight
  • gpt-4.1-nano — GPT-4.1 ultra-lightweight
  • gpt-4o — GPT-4o multimodal model
  • gpt-4o-mini — GPT-4o lightweight
  • o1 — OpenAI o1 reasoning model
  • o3-mini — OpenAI o3 Mini
  • o4-mini — OpenAI o4 Mini

Anthropic series

  • claude-opus-4.6 — Claude 4.6 Opus, latest flagship
  • claude-sonnet-4.6 — Claude 4.6 Sonnet, latest version
  • claude-opus-4.5 — Claude 4.5 Opus flagship
  • claude-sonnet-4.5 — Claude 4.5 Sonnet, balanced
  • claude-haiku-4.5 — Claude 4.5 Haiku, fast response

Google series

  • gemini-3.1-pro-preview — Gemini 3.1 Pro preview
  • gemini-3-flash-preview — Gemini 3 Flash preview
  • gemini-2.5-pro — Gemini 2.5 Pro
  • gemini-2.5-flash — Gemini 2.5 Flash
  • gemini-2.5-flash-lite — Gemini 2.5 Flash Lite

DeepSeek series

  • deepseek-r1-0528 — DeepSeek R1 reasoning model
  • deepseek-v3.2 — DeepSeek V3.2
  • deepseek-v3.2-exp — DeepSeek V3.2 experimental

MiniMax series

  • minimax-m2.1 — MiniMax M2.1
  • minimax-m2.5 — MiniMax M2.5

MoonshotAI series

  • kimi-k2.5 — Kimi K2.5
  • kimi-k2-thinking — Kimi K2 Thinking

Z.ai series

  • glm-4.6 — GLM 4.6
  • glm-4.7 — GLM 4.7
  • glm-5 — GLM 5
  • glm-5.1 — GLM 5.1

Examples

Basic chat

{
  "model": "gpt-5",
  "messages": [
    {"role": "user", "content": "你好"}
  ]
}

System prompt

{
  "model": "claude-sonnet-4.5",
  "messages": [
    {"role": "system", "content": "你是一位专业的Python编程导师"},
    {"role": "user", "content": "如何使用列表推导式?"}
  ]
}

Multi-turn conversation

{
  "model": "gemini-2.5-flash",
  "messages": [
    {"role": "user", "content": "什么是机器学习?"},
    {"role": "assistant", "content": "机器学习是人工智能的一个分支..."},
    {"role": "user", "content": "能举个例子吗?"}
  ]
}

Streaming output

{
  "model": "gpt-5",
  "messages": [
    {"role": "user", "content": "写一首关于春天的诗"}
  ],
  "stream": true
}

Advanced features

This endpoint covers basic text chat. For advanced features, see: