Code Monkey home page Code Monkey logo

chatgptapifree's Introduction

ChatGPT API Free

简体中文版 - 繁體中文版

Welcome to the ChatGPT API Free project, a simple and open-source proxy API that allows you to access OpenAI's ChatGPT API for free.

You may want to check out the Free ChatGPT website!

News

  • 2023-03-26: It is with a heavy heart that I announce the archiving of the ChatGPTAPIFree repository. Our endeavour to provide a free API for all has reached an unsustainable financial crossroad, prompting a temporary halt in our pursuit of equal access to AI technology. Despite this setback, our commitment remains unwavering. We will continue to explore alternative methods and advocate for OpenAI to lower their API pricing and remove regional restrictions. While our progress may have slowed, our resolve to create a world where the power of AI is accessible to all is stronger than ever.
  • 2023-03-14: A kind group member sponsored this project with 400 USD, which enables the free API to run for an even longer period of time.
  • 2023-03-12: A kind group member sponsored this project with 5000 CNY (724 USD), allowing for continued free access to ChatGPT. Rate limits have been implemented to ensure the API's stability and security. You are welcome to support this project by sponsoring it or hosting your own API endpoint.
  • 2023-03-04: Check out the Free ChatGPT, an amazing open-source web application that allows you to interact with OpenAI's ChatGPT API for free. It is built on top of this project.

The Open ChatGPT Initiative

In a world where technology advances at an exponential pace, where the line between man and machine grows increasingly blurred, it is the responsibility of those who have the capability to create, to ensure that the benefits of this progress are shared by all.

With this in mind, I would like to present to you the Open ChatGPT Initiative. A beacon of hope in a world where the potential of AI is limited by the barrier and the cost of entry. A free and open-source proxy API that removes the barriers to accessing the latest AI technology, and makes it available to all.

This project was born from a belief, a belief in a future where the power of artificial intelligence is not reserved for the privileged few, but available to every creator, every innovator, and every dreamer.

It is a belief that technology should serve humanity, not the other way around. A belief that access to the latest advancements should not be determined by one’s technological ability or financial resources, but by one’s creativity, imagination and ambition.

This project does not seek to revolutionise the AI industry, but to democratise it. To make the power of AI accessible to every person, regardless of their background or financial situation. To promote equality, education, and innovation.

It is my sincerest hope that this project will be a catalyst for change, a rallying point for those who believe that the benefits of AI should be shared by all. Join me in this endeavour, and let us create a future where the power of AI belongs to us all.

If you would like to read another article with more technical details, please read Unleashing the Boundlessness of ChatGPT: A Public Appeal.

Usage

To use ChatGPT API Free, simply send a POST request to the following endpoint:

https://chatgpt-api.shn.hk/v1/

For instance, to generate a response to the prompt "Hello, how are you?" using the gpt-3.5-turbo model, send the following curl command:

curl https://chatgpt-api.shn.hk/v1/ \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "gpt-3.5-turbo",
  "messages": [{"role": "user", "content": "Hello, how are you?"}]
}'

You can view the full API documentation on the OpenAI official documentation.

Introduction

ChatGPT is a world-renowned conversational AI model developed by OpenAI, known for generating human-like responses to various prompts and queries. With its cutting-edge capabilities, ChatGPT is a valuable asset for chatbots, virtual assistants, and other natural language processing applications.

The ChatGPT API is a powerful tool that allows developers to integrate the ChatGPT model into their own applications. However, to use this API, users need to have an OpenAI API key and pay for usage.

ChatGPT API Free believes that everyone should have access to the latest AI technology without the financial burden of paying for an API key. This open-source proxy API allows you to access the ChatGPT API without a key, promoting accessibility and innovation for all.

What does ChatGPT API Free do?

This simple proxy API acts as a bridge between you and the OpenAI ChatGPT API. You can send requests to the ChatGPT API Free endpoint using the same format as the original API. This proxy API then forwards the request to the OpenAI API with an API key provided by this project, and the response from the OpenAI API is returned to you.

Significance

The ChatGPT API Free project is a game-changer for the AI development community. With the proxy API, anyone can access the state-of-the-art ChatGPT model without needing a key. This accessibility fosters creativity, innovation, and collaboration among developers, and could potentially lead to groundbreaking advancements in AI technology.

Moreover, other successful projects such as ChatGPT Free App build on top of this API, showing the vast potential of this project.

Privacy Statement

This project highly values privacy and is committed to safeguarding the privacy of its users. This project does not collect, record, or store any text entered by users or returned by the OpenAI server in any manner. This project does not provide any information to OpenAI or any third parties about the identity of API callers, including but not limited to IP addresses and user-agent strings. The source code of this project is available for inspection to verify this statement.

However, the OpenAI API does retain data for 30 days in accordance with its data usage policies.

Host Your Own Instance

If you'd like to run your own instance of ChatGPT API Free, you can easily do so by following these steps:

  1. Obtain an OpenAI API Key from OpenAI API Keys.
  2. Star and fork this repository on GitHub.
  3. Configure your environment variables correctly.
  4. Deploy Docker locally or on Google Cloud Run.
  5. Setup rate limit locally or using Google Cloud Armor.

Improve this project

This project is always seeking ways to improve and welcomes feedback and contributions from its users. If you have any suggestions or ideas, please feel free to create an issue or submit a pull request on the GitHub repository.

Sponsor me!

If you find ChatGPT API Free useful, please consider sponsoring the author on GitHub to support ongoing development and maintenance. Your support would help her maintain this project and continue to make AI technology accessible for all. Thank you for your support!

Ko-fi Ko-fi
Alipay Alipay
WeChat WeChat

chatgptapifree's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

chatgptapifree's Issues

Google Cloud Armor Rules

Hi Ayaka,

I want to self-host my own API endpoint, please kindly share what Google Cloud Armor rules did you use?

Thank you.

hope it can be the power grid

Al application developers do not need to develop a power grid first in order for users to use electronic appliances.

Not Found error.

I created a docker image and ran it using:

docker build -t chatgpt:1.0 .
docker run -d -p 8080:8080 chatgpt:1.0
I exposed port 8080 of the container, so I could use it on my localhost browser.

The server is listening on 8080 but when I tried to run it, I get a 'not found' error.

index.js references some /v1/chat/completions folder but I don't see it in the local directory.

I renamed ".env.example" to ".env" and entered two OpenAI API keys there. Prior to renaming it, I was getting some other error related to the JSON parse error.

One error is leading to fixing another thing and now I am stuck on this 'Not found' page.

Any light on this matter would be greatly appreciated. Thanks.

PS: I am running Docker Desktop latest version, x86 machine, Windows 10.

Hi! Boss!

As I am a personal developer, Open AI recharge is not supported in my area, and my personal free API account has been banned recently, so this project is of great help to me! I hope it can survive for a long time. As a student, I don't have a lot of money, but I have contributed some small money to you, hoping to help this project. If you can't stick to this free project, I hope I can pay for it. Please let me know before you finish this project. Thank you. Sincerely Ming-XF.

Are you okay?

Because you are literally paying for others without any rewards. I am thankful about it, but just concerning: are you okay?

How do I use this agent in vscode chatgpt?

I use vscode plugin: https://github.com/gencay/vscode-chatgpt

I configured the following proxy in settings.json:

{
    "chatgpt.gpt3.apiBaseUrl": "https://chatgpt-api.shn.hk"
}

But report an error:

Your method: 'GPT3 OpenAI API Key' and your model: 'gpt-3.5-turbo' may be incompatible or you may have exhausted your ChatGPT subscription allowance. (HTTP 404 Not Found) ChatGPT error 404: Not found

Quota Exceeded

Getting this when making a request:

HTTP 429

OpenAI API responded with:

{
    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details.",
        "type": "insufficient_quota",
        "param": null,
        "code": null
    }
}

bug: KV PUT failed

Hello, Ms. Ayaka!

I received an error message that says "KV PUT failed: 400 Invalid expiration of 1678125600. Expiration times must be at least 60 seconds in the future," while using your unmodified code. Based on the error message, it seems that the expiration time used in the kv.put function is not valid because the expiration parameter provided is less than 60 seconds ahead of the current time.

To resolve the error, we can update the expiration time by adding 60 seconds to the current time using the moment library's add() method before converting it to a Unix timestamp using the unix() method. We can achieve this by using the following code:

const rateLimitExpiration = utcNow.startOf('hour').add(1, 'hour').add(60, 'seconds').unix();

By doing this, the expiration parameter passed to the kv.put function will always be at least 60 seconds in the future, and the error should no longer occur.

Please let me know your thoughts on this solution.

Unable to connect to Free ChatGPT

Description: I am unable to access the Free ChatGPT website at https://freechatgpt.chat/. The page is taking too long to load and seems unresponsive. I have tried accessing it multiple times, but the issue persists. I suspect it's not a network issue on my end.

Steps to reproduce:

  1. Visit https://freechatgpt.chat/

  2. Try to connect with valid credentials

  3. Observe the slow loading and unresponsiveness of the page

I have tried accessing the website from different devices and networks, but the issue remains the same. Kindly assist in resolving this issue.

Thank you.

提个建议:api域名url可不可以做到和官网一致?

比如 https://api.openai.com/v1/chat/completionshttps://chatgpt-api.shn.hk/v1/chat/completions 对齐。因为有很多其他开发者开发的应用中很多都提供了自定义域名功能,比如我填 https://xxx.com 它们软件底层就会自动处理成 https://xxx.com/v1/chat/completions ,但是用本项目提供的域名的话,填 https://chatgpt-api.shn.hk 它们会处理成 https://chatgpt-api.shn.hk/v1/chat/completions ,那么就无法使用到本项目的功能了。

以及, https://chatgpt-api.shn.hk 也可能随时被墙

wrangler.toml

Hi Ma'am Ayaka!

Thank you for this. Hoping you can help me how to set up the wrangler.toml properly since I have multiple Cloudflare accounts connected to my main CF account.

Let's say I wanted to use the AAA account.

Thank you :)

✘ [ERROR] More than one account available but unable to select one in non-interactive mode.

If you think this is a bug then please create an issue at https://github.com/cloudflare/workers-sdk/issues/new/choose
Please set the appropriate account_id in your wrangler.toml file.
Available accounts are (<name>: <account_id>):
AAA: ece12a4fbc7b131fc17d118
BBB: c1b0fa2f2e392fd5dbbca5e3e
CCC: 04ecf3126ab6a336d11c[25](https://github.com/xxxxx/actions/runs/43xxjobs/756xx756#step:5:26)7d4c746116
DDD: f618f8ef0557ef4d9c898c6c[26](https://github.com/xxxxx/actions/runs/43xx0380/jobs/7xx56#step:5:27)7821a
EEE: 5f1d81df6a7ba9461f756a8faeb34[29](https://github.com/xxxxx/actions/runs/4xxx0/jobs/75xx56#step:5:30)

How to Support?

Just saw this amazing initiative. I really wanted to try out ChatGPT, but I didn't have a Phone Number. Now I can experiment with it. Thanks very much.

I do want to support this project, but I can't financially, sorry. But I am a student learning developing/programming, and probably can help with anything you want.

Just tell me 😉

OpenAI API responded: { "error": { "message": "Your access was terminated due to violation of our policies, please check your email for more information. If you believe this is in error and would like to appeal, please contact [email protected].", "type": "access_terminated", "param": null, "code": null } }

Please fix this
OpenAI API responded: { "error": { "message": "Your access was terminated due to violation of our policies, please check your email for more information. If you believe this is in error and would like to appeal, please contact [email protected].", "type": "access_terminated", "param": null, "code": null } }

Error on deploy using Back4App

2023-03-16T15:19:39.291Z # trying to hit the 8080 port using http

2023-03-16T15:19:42.376Z # it looks that no process is listening to the 8080 port using http

2023-03-16T15:19:42.377Z # app did not turn healthy after several checks

2023-03-16T15:19:42.378Z # deployment failed

Does anyone know how I can fix it?

feature: MongoDB Error Handling

Hi Ayaka!

I am writing to suggest improving the reliability of the ChatGPTAPIFree by implementing proper error handling for MongoDB connections.

Currently, the code assumes that the connection to MongoDB will always succeed, but there are several reasons why the connection could fail, such as network issues or invalid credentials. As a result, the lack of proper error handling may lead to critical issues, such as data loss or incorrect data processing.

I recommend adding error handling for MongoDB connection failures to address this issue. By doing so, you can improve the reliability of the API and reduce the risk of data loss or incorrect data processing.

Thank you for considering my suggestion.

Sample code:

Screenshot (170)

  • The MongoClient is created outside the app variable and connected to MongoDB using the connect() method. If an error occurs, the code logs the error and exits the process with an exit code of 1 to indicate a fatal error.
  • The MongoDB collection is created, and the indexes are created as before.
  • The catch block of the /v1/ route now logs the error to the console before sending a generic error message back to the client.
  • This implementation should now handle errors related to MongoDB connections.
const client = new MongoClient(uri);
client.connect((err) => {
  if (err) {
    console.error(err);
    process.exit(1);
  } else {
    console.log('Connected successfully to MongoDB at ' + uri);
  }
});
    resUpstream.body.pipe(res);
  } catch (error) {
    console.error(error);
    res.status(500).set(corsHeaders).type('text/plain').send('Internal server error');
  }
});

Error 429 : Too many requests

Hello, I send a request with python, but I got this error.

requests.exceptions.JSONDecodeError: [Errno Expecting value] <!doctype html><title>429</title>429 Too Many Requests: 0

Bests Regards

access_terminated

Your access was terminated due to violation of our policies, please check your email for more information. If you believe this is in error and would like to appeal, please contact [email protected].

The above error occurs when I use。

Do I have to pay?

I wondered, if you want to host your own api, do you have to pay for the tokens?

CORS Error

Hello Ms. Ayaka,

I successfully setup my own instance unfortunately I am having a problem with CORS policy, here are the error messages I am getting from Google Run and web console:

{
httpRequest: {11}
insertId: "640c4eXXXXXXXXXbef81ca15"
labels: {5}
logName: "projects/XXXXX/logs/run.googleapis.com%2Frequests"
receiveTimestamp: "2023-03-11T09:50:XXXXZ"
resource: {2}
severity: "ERROR"
spanId: "4361714022011534635"
textPayload: "The request failed because either the HTTP response was malformed or connection to the instance had an error. Additional troubleshooting documentation can be found at: https://cloud.google.com/run/docs/troubleshooting#malformed-response-or-connection-error"
timestamp: "2023-03-11T09:50:3XXXZ"
trace: "pXXXX14faaa"
}

Access to fetch at 'https://XXXXX.a.run.app/v1/' from origin 'https://aXXXXX.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Response Headers

access-control-allow-headers: Content-Type, Authorization
access-control-allow-methods: GET, HEAD, POST, OPTIONS
access-control-allow-origin: *
alt-svc: h3=":443"; ma=xx29=":443"; ma=2592000,h3-Q0xxx:443"; ma=259xx0,quic=":443"; ma=2592000; v="46,43"
content-length: 9
content-type: text/plain; charset=utf-8
date: Sat, 11 Mar 2023 09:59:10 GMT
server: Google Frontend
x-cloud-trace-context: ef8663xxx533eed

Thank you.

How it possible test any integration without limitation?

Free with limited quota? I think so this is not free, just trial.

OpenAI API responded:

{
    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details.",
        "type": "insufficient_quota",
        "param": null,
        "code": null
    }
}

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.