1. 聊天(Chat)
炼丹侠 API Docs
  • 指南
  • 聊天(Chat)
    • 对话聊天(OpenAI 格式)
      POST
    • 对话聊天(Anthropic 格式)
      POST
  1. 聊天(Chat)

对话聊天(OpenAI 格式)

POST
/chat/completions
给定一个提示词,该模型将返回一个或多个预测结果,并且还可以返回每个位置上其他可能词汇的概率。您可以根据提供的提示词和参数生成内容。

请求参数

Header 参数

Body 参数application/json

示例
{
    "model": "Qwen3.5-35B-A3B",
    "messages": [
        {
            "role": "user",
            "content": "你好"
        }
    ],
    "max_tokens": 1024
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
cURL
curl --location 'https://api.liandanxia.com/v1/chat/completions' \
--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
--header 'Content-Type: application/json' \
--data '{
    "model": "Qwen3.5-35B-A3B",
    "messages": [
        {
            "role": "user",
            "content": "你好"
        }
    ],
    "max_tokens": 1024
}'

返回响应

🟢200OK
application/json
Bodyapplication/json

示例
{
    "id": "32a853002ff14a8fa17c2d2dffcb6388",
    "object": "chat.completion",
    "created": 1757063084,
    "model": "DeepSeek-R1-0528",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "<think>\nOkay, the user just said \"Hello!\" - a simple greeting to start the conversation.  \n\nHmm, this seems like a friendly opener with no complex needs behind it. The user probably wants to test the waters or establish a connection before diving into actual requests.  \n\nGiven how open-ended this is, I'll match their casual tone with warmth and enthusiasm. A smile emoji feels appropriate here to make the interaction feel human.  \n\nNo need to overthink - just acknowledge their greeting and leave the next move to them. They'll clarify their needs when ready.  \n\nSide note: The simplicity suggests they might be new users. I should watch for follow-up cues to adjust my support level.\n</think>\nHello! 😊 How can I assist you today? Whether you have a question, need help with something, or just want to chat—I'm here to help!",
                "reasoning_content": null,
                "tool_calls": null
            },
            "logprobs": null,
            "finish_reason": "stop",
            "matched_stop": 1
        }
    ],
    "usage": {
        "prompt_tokens": 11,
        "total_tokens": 189,
        "completion_tokens": 178,
        "prompt_tokens_details": null,
        "reasoning_tokens": 0
    },
    "metadata": {
        "weight_version": "default"
    }
}
修改于 2026-04-14 05:19:32
上一页
指南
下一页
对话聊天(Anthropic 格式)
Built with