chatgpt接口调用

在线接口文档:

https://app.apifox.com/invite?token=symrLP7sojF6N31kZqnpZ

|---|---|---|
| 接口地址 https://chat.xutongbao.top/api/light/chat/createChatCompletion |||
| 请求方式 POST |||
| 请求参数 token String, 必须 prompt Array, 必须 例子一: 包含上下文 [ { "role": "user", "content": "北京有多少人" }, { "role": "assistant", "content": "根据2021年数据,北京市的人口总数约为 2170 万人。请注意,人口数量可能会随时间变化而有所变动。" }, { "role": "user", "content": "上海呢" } ] 例子二: [ { "role": "user","content": "你好"} ] model String, 可选。 可选值: "gpt-3.5-turbo-16k" 、 "gpt-4"。 默认值为: "gpt-3.5-turbo-16k" params Object, 可选 例子一: 一次提问得到两个答案 { "n": 2 } 其他Open AI官方支持的参数可以通过对象格式传递,官方文档:https://platform.openai.com/docs/api-reference/completions/create |||
| 在线文档 Apifox |||
| 请求参数示例 { "model": "gpt-3.5-turbo-16k", "token": "sk-3d76d415-dd72-43ff-b7c8-65fb426f1d7b", "prompt": [ { "role": "user", "content": "你好" } ], "params": { "n": 1 } } |||

请求参数示例:

javascript 复制代码
{
    "model": "gpt-3.5-turbo-16k",
    "token": "sk-xxx",
    "prompt": [
        {
            "role": "user",
            "content": "你好"
        }
    ],
    "params": {
        "n": 1
    }
}

响应参数示例:

javascript 复制代码
{
    "code": 200,
    "data": {
        "completion": {
            "id": "chatcmpl-8Fw63MbbFvizz1uz7hs1wHG7iEYgK",
            "object": "chat.completion",
            "created": 1698808935,
            "model": "gpt-3.5-turbo-16k-0613",
            "choices": [
                {
                    "index": 0,
                    "message": {
                        "role": "assistant",
                        "content": "【测试】你好!请问有什么我可以帮助你的吗?"
                    },
                    "finish_reason": "stop"
                }
            ],
            "usage": {
                "prompt_tokens": 9,
                "completion_tokens": 38,
                "total_tokens": 47
            }
        },
        "info": {
            "isSdHide": "0",
            "sdLimitCount": 200,
            "sdTextToImg": 160,
            "token": "sk-xxx",
            "numOfOneDayCanCallApi": 7,
            "numOfOneDayAlreadyCallApi": 2,
            "apiDate": "2023-11-01"
        }
    },
    "message": "成功"
}

获取token的方法:

访问:https://chat.xutongbao.top/

注册账号-》登录-》我的-》API

相关推荐
二十一_1 天前
🤖✨ ChatGPT API深度体验:让AI看懂图片、听懂语音、调用你的代码
前端·chatgpt·openai
福宝plus1 天前
只需1美元薅ChatGPT Team手把手的教程,教你如何解决“你不符合参与此促销活动折扣资格”或“您的银行卡被拒绝了”附上ChatGPT Team怎么取消订阅
chatgpt·openai·claude
dafanpai2 天前
Claude vs ChatGPT vs Gemini:功能对比、使用体验、适合人群
人工智能·chatgpt
dafanpai2 天前
gemini和chatgpt数据对比:谁在卷性能、价格和场景?
人工智能·chatgpt
爱吃的小肥羊3 天前
ChatGPT又双叒叕升级了,AI编程能联网,记忆功能免费用!
chatgpt·openai
我教你啊3 天前
不连网也能跑大模型?
chatgpt
nvvas4 天前
AI互联网辅助工具
人工智能·chatgpt
量子位4 天前
ChatGPT 普通会员能用编程神器 Codex 了!支持联网,奥特曼:更多更新在路上
chatgpt·ai编程
AmazingKO4 天前
5分钟申请edu邮箱【方案本周有效】
python·chatgpt·ai编程·竹相左边·edu教育邮箱
爱吃的小肥羊5 天前
GPT-5 确定 7月发布?似乎不是谣言!
chatgpt·openai