LLM Hub Docs
  1. OpenAI 格式(Chat)
LLM Hub Docs
  • 获取模型列表
    • OpenAI 格式
      GET
    • Gemini 格式
      GET
  • 聊天
    • OpenAI 格式(Chat)
      • OpenAI Chat Completions
        POST
      • OpenAI Responses
        POST
    • Claude Message
      POST
    • Gemini Generating Content
      POST
  • 文本补全(Completions)
    • 创建文本补全
      POST
  • 音频(Audio)
    • OpenAI 格式
      • 文本转语音
      • 音频转录
      • 音频翻译
    • Gemini 格式
      POST
  • 视频(Videos)
    • Sora 格式
      • 创建视频
      • 获取视频任务状态
      • 获取视频内容
      • 视频混剪
    • 可灵格式
      • Kling 文生视频
      • 获取 Kling 文生视频任务状态
      • Kling 图生视频
      • 获取 Kling 图生视频任务状态
    • 即梦格式
      • 即梦视频生成
    • 创建视频生成任务
      POST
    • 获取视频生成任务状态
      GET
  • 图片(Images)
    • OpenAI 格式
      • 生成图像
      • 编辑图像
    • Qwen 格式
      • 生成图像
      • 编辑图像
    • Gemini 格式
      POST
  • Realtime
    • 实时 WebSocket 连接
      GET
  • 嵌入(Embeddings)
    • OpenAI 格式
      POST
    • Gemini 格式
      POST
  • 审查(Moderations)
    • 内容审核
  • 重排序(Rerank)
    • 文档重排序
  • 未实现
    • Fine-tunes
      • 列出微调任务 (未实现)
      • 创建微调任务 (未实现)
      • 获取微调任务详情 (未实现)
      • 取消微调任务 (未实现)
      • 获取微调任务事件 (未实现)
    • Files
      • 列出文件 (未实现)
      • 上传文件 (未实现)
      • 获取文件信息 (未实现)
      • 删除文件 (未实现)
      • 获取文件内容 (未实现)
  • Gemini格式
    • Gemini 流式聊天 (streamGenerateContent)
  • Midjourney
    • Midjourney 生成图片
    • Midjourney 变换操作
    • Midjourney 图片描述
    • Midjourney 图片融合
    • 获取 Midjourney 任务状态
    • 按条件查询 Midjourney 任务
    • 获取 Midjourney 图片
  • Playground
    • Playground 聊天
  • Suno
    • Suno 提交任务
    • 获取 Suno 任务状态
    • 批量获取 Suno 任务
  • 创建编辑
    POST
  • 数据模型
    • ErrorResponse
    • Usage
    • Model
    • ModelsResponse
    • GeminiModelsResponse
    • Message
    • MessageContent
    • ToolCall
    • Tool
    • ResponseFormat
    • ChatCompletionRequest
    • ChatCompletionResponse
    • ChatCompletionStreamResponse
    • CompletionRequest
    • CompletionResponse
    • ResponsesRequest
    • ResponsesResponse
    • ResponsesStreamResponse
    • ClaudeRequest
    • ClaudeMessage
    • ClaudeResponse
    • EmbeddingRequest
    • EmbeddingResponse
    • ImageGenerationRequest
    • ImageEditRequest
    • ImageResponse
    • ImageGenerationResponse
    • AudioTranscriptionRequest
    • AudioTranslationRequest
    • AudioTranscriptionResponse
    • SpeechRequest
    • RerankRequest
    • RerankResponse
    • ModerationRequest
    • ModerationResponse
    • GeminiRequest
    • GeminiResponse
    • GeminiAudioResponse
    • VideoRequest
    • VideoResponse
    • VideoTaskResponse
    • VideoTaskMetadata
    • VideoTaskError
    • OpenAIVideo
    • OpenAIVideoError
    • MjTaskResponse
    • MjTaskResult
    • SunoTaskResponse
    • SunoTaskResult
    • ApiResponse
    • PageInfo
    • User
    • Channel
    • Token
    • Redemption
    • Log
  1. OpenAI 格式(Chat)

OpenAI Chat Completions

POST
/v1/chat/completions
根据对话历史创建模型响应。支持流式和非流式响应。
兼容 OpenAI Chat Completions API。

请求参数

Authorization
Bearer Token
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
or
Body 参数application/json必填

示例
{
    "model": "gpt-4",
    "messages": [
        {
            "role": "system",
            "content": "string",
            "name": "string",
            "tool_calls": [
                {
                    "id": "string",
                    "type": "function",
                    "function": {
                        "name": "string",
                        "arguments": "string"
                    }
                }
            ],
            "tool_call_id": "string",
            "reasoning_content": "string"
        }
    ],
    "temperature": 1,
    "top_p": 1,
    "n": 1,
    "stream": false,
    "stream_options": {
        "include_usage": true
    },
    "stop": "string",
    "max_tokens": 0,
    "max_completion_tokens": 0,
    "presence_penalty": 0,
    "frequency_penalty": 0,
    "logit_bias": {
        "property1": 0,
        "property2": 0
    },
    "user": "string",
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "string",
                "description": "string",
                "parameters": {}
            }
        }
    ],
    "tool_choice": "none",
    "response_format": {
        "type": "text",
        "json_schema": {}
    },
    "seed": 0,
    "reasoning_effort": "low",
    "modalities": [
        "text"
    ],
    "audio": {
        "voice": "string",
        "format": "string"
    }
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.llmhub.com.cn/v1/chat/completions' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "gpt-4",
    "messages": [
        {
            "role": "system",
            "content": "string",
            "name": "string",
            "tool_calls": [
                {
                    "id": "string",
                    "type": "function",
                    "function": {
                        "name": "string",
                        "arguments": "string"
                    }
                }
            ],
            "tool_call_id": "string",
            "reasoning_content": "string"
        }
    ],
    "temperature": 1,
    "top_p": 1,
    "n": 1,
    "stream": false,
    "stream_options": {
        "include_usage": true
    },
    "stop": "string",
    "max_tokens": 0,
    "max_completion_tokens": 0,
    "presence_penalty": 0,
    "frequency_penalty": 0,
    "logit_bias": {
        "property1": 0,
        "property2": 0
    },
    "user": "string",
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "string",
                "description": "string",
                "parameters": {}
            }
        }
    ],
    "tool_choice": "none",
    "response_format": {
        "type": "text",
        "json_schema": {}
    },
    "seed": 0,
    "reasoning_effort": "low",
    "modalities": [
        "text"
    ],
    "audio": {
        "voice": "string",
        "format": "string"
    }
}'

返回响应

🟢200
application/json
成功创建响应
Body

示例
{
    "id": "string",
    "object": "chat.completion",
    "created": 0,
    "model": "string",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "system",
                "content": "string",
                "name": "string",
                "tool_calls": [
                    {
                        "id": "string",
                        "type": "function",
                        "function": {
                            "name": "string",
                            "arguments": "string"
                        }
                    }
                ],
                "tool_call_id": "string",
                "reasoning_content": "string"
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 0,
        "completion_tokens": 0,
        "total_tokens": 0,
        "prompt_tokens_details": {
            "cached_tokens": 0,
            "text_tokens": 0,
            "audio_tokens": 0,
            "image_tokens": 0
        },
        "completion_tokens_details": {
            "text_tokens": 0,
            "audio_tokens": 0,
            "reasoning_tokens": 0
        }
    },
    "system_fingerprint": "string"
}
🟠400
🟠429
修改于 2025-12-22 14:05:51
上一页
Gemini 格式
下一页
OpenAI Responses
Built with