8000 GitHub - lkunxyz/chatgpt2api
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

lkunxyz/chatgpt2api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChatGPT to API

将 ChatGPT 网页版 转为 API, 方便程序化调用

1. 安装 浏览器插件

仅支持 Firefox 系浏览器

Firefox Nightly: https://www.mozilla.org/en-US/firefox/channel/desktop

Zen: https://zen-browser.app

插件下载: chatgpt2api

插件安装教程: install ext

2. 安装成功后调用 API

chat2api 接口文档

endpoint: http://127.0.0.1:4001

接口地址: http://127.0.0.1:4001/v1/:client_id/generate 请求方式: POST 请求头: Content-Type: application/json

请求参数

参数名 类型 必须 说明
prompt string 发送给ChatGPT的文本提示
images array 图片URL数组,必须公网可以访问

client_id 在 chatgpt 网页中复制

curl --location 'http://127.0.0.1:4001/v1/:client_id/generate' \
--header 'Content-Type: application/json' \
--data '{
    "prompt": "hi"
}'

curl --location 'http://127.0.0.1:4001/v1/:client_id/generate' \
--header 'Content-Type: application/json' \
--data '{
    "prompt": "一位中国模特, 展示这款包",
    "images": ["https://dow.chatbee.cc/482e3a99-2806-45d5-863e-70c3ca48c37f.png"]    
}'

响应格式: Server-Sent Events (SSE)

响应事件类型:

  • task: 任务开始信息,包含task_id和状态
  • result: 生成结果, 每次消息为全量内容
  • heartbeat: 心跳事件(每15秒)

注意事项

  • 生成任务的超时时间为10分钟
  • 心跳事件每15-30秒发送一次,保持连接活跃
  • 生成结果中包含 [DONE] 标记时表示任务已完成

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages publishe 2EC2 d
0