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 小时前
生成不遗忘,「超长时序」世界模型,北大EgoLCD长短时记忆加持
人工智能·深度学习·算法·自然语言处理·chatgpt
victory04316 小时前
后训练的起点 学术路线
chatgpt
中國龍在廣州6 小时前
2025,具身智能正在惩罚“持有者”
人工智能·深度学习·算法·自然语言处理·chatgpt
hunteritself8 小时前
Adobe 把 Photoshop 搬进了 ChatGPT,免费的
gpt·机器学习·ui·adobe·chatgpt·智能手机·photoshop
SEO_juper1 天前
AI搜索引擎品牌提及指南:用数据驱动策略,让品牌被AI主动推荐
人工智能·搜索引擎·chatgpt
雪花desu2 天前
深度解析RAG(检索增强生成)技术
人工智能·深度学习·语言模型·chatgpt·langchain
juhanishen2 天前
Agentic AI: Chain of Thoughts (COT) CrewAI 一步步解释,从 0 到 1
人工智能·chatgpt·cot·agentic ai·agenticai·chain of though
Zilliz Planet2 天前
ChatGPT VS Claude ,Agent记忆用对话压缩还是RAG按需检索
chatgpt
冬奇Lab2 天前
Prompt工程进阶:用角色扮演让AI成为领域专家
人工智能·chatgpt·prompt
智慧地球(AI·Earth)2 天前
CEO亲自宣传!全新ChatGPT Images!
人工智能·chatgpt