Git Product home page Git Product logo

go-chatgpt-api's Introduction

go-chatgpt-api

Unofficial ChatGPT API.

Available APIs:


  • get conversation list

GET /conversations?offset=0&limit=20

offset defaults to 0, limit defaults to 20 (max 100).


  • get conversation content

GET /conversation/{conversationID}


  • create conversation

POST /conversation

{
  "action": "next",
  "messages": [
    {
      "id": "message id",
      "author": {
        "role": "user"
      },
      "content": {
        "content_type": "text",
        "parts": [
          "Hello World"
        ]
      }
    }
  ],
  "parent_message_id": "parent message id",
  "conversation_id": "conversation id",
  "model": "text-davinci-002-render-sha",
  "timezone_offset_min": -480,
  "history_and_training_disabled": false
}

  • generate conversation title

POST /conversation/gen_title/{conversationID}

{
  "message_id": "role assistant response message id"
}

  • rename conversation

PATCH /conversation/{conversationID}

{
  "title": "new title"
}

  • delete conversation

PATCH /conversation/{conversationID}

{
  "is_visible": false
}

  • delete all conversations

PATCH /conversations

{
  "is_visible": false
}

  • feedback message

POST /conversation/message_feedback

{
  "message_id": "message id",
  "conversation_id": "conversation id",
  "rating": "thumbsUp/thumbsDown"
}

  • login (currently only support ChatGPT accounts)

POST /auth/login

{
  "username": "email",
  "password": "password"
}

  • chat completion (apiKey)

POST /v1/chat/completions

{
  "messages": [
    {
      "role": "user",
      "content": "Hello World"
    }
  ],
  "model": "gpt-3.5-turbo",
  "stream": true
}

No need to run chatgpt-proxy-server anymore.


If you need to setup a proxy, use GO_CHATGPT_API_PROXY, for example: GO_CHATGPT_API_PROXY=http://127.0.0.1:20171 or GO_CHATGPT_API_PROXY=socks5://127.0.0.1:20170.

services:
  go-chatgpt-api:
    container_name: go-chatgpt-api
    image: linweiyuan/go-chatgpt-api
    ports:
      - 8080:8080
    environment:
      - GIN_MODE=release
      - GO_CHATGPT_API_PROXY=
    restart: unless-stopped

If you get Access denied, but the server location is officially supported here, have a try with this:

services:
  go-chatgpt-api:
    container_name: go-chatgpt-api
    image: linweiyuan/go-chatgpt-api
    ports:
      - 8080:8080
    environment:
      - GIN_MODE=release
      - GO_CHATGPT_API_PROXY=socks5://chatgpt-proxy-server-warp:65535
    depends_on:
      - chatgpt-proxy-server-warp
    restart: unless-stopped

  chatgpt-proxy-server-warp:
    container_name: chatgpt-proxy-server-warp
    image: linweiyuan/chatgpt-proxy-server-warp
    environment:
      - LOG_LEVEL=OFF
    restart: unless-stopped

After go-chatgpt-api is up, if you call API but it returns 403, please try again and again, once 200 is returned, then it is ready to use.

go-chatgpt-api's People

Contributors

linweiyuan avatar nephen avatar slippersheepig avatar time-river avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.