搜索结果

×

搜索结果将在这里显示。

快速接入神算API

基础信息

  • Base URL: https://openai-ss.cn
  • 认证方式: Bearer Token (API Key)

文本对话接口

请求

  • 方法: POST
  • 路径: /v1/chat/completions
  • Headers:
    • Accept: application/json
    • Authorization: Bearer sk-** (你的API Key)
    • Content-Type: application/json

请求参数

{
  "model": "gpt-4o-mini",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "周树人和鲁迅是兄弟吗?"
    }
  ]
}

cURL 示例

curl -X POST "https://openai-ss.cn/v1/chat/completions" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sk-******" \  # 替换为你的API Key
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "周树人和鲁迅是兄弟吗?"
      }
    ]
  }'

Python 示例

import requests
import json

# API配置
url = "https://openai-ss.cn/v1/chat/completions"
headers = {
    'Accept': 'application/json',
    'Authorization': 'Bearer sk-******',  # 替换为你的API Key
    'Content-Type': 'application/json'
}

# 请求数据
payload = json.dumps({
    "model": "gpt-4o-mini",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "周树人和鲁迅是兄弟吗?"
        }
    ]
})

# 发送请求
response = requests.post(url, headers=headers, data=payload)

# 输出响应
print(response.text)

响应

返回JSON格式的对话结果


提示:将示例中的sk-******替换为你实际的API Key即可使用