acheong08 / chatgpt-api-server Goto Github PK
View Code? Open in Web Editor NEWAPI server for ChatGPT
License: MIT License
API server for ChatGPT
License: MIT License
Having troubles. I can get server setup and see my connection when opening gpt through firefox, but I have no idea what to do after that. Complete noob someone dear lord please help I wanna use this chat without the moderation. I use git bash for the $ command and once upon a time it connected but now it says ' No chat available' or something similar. A more in-depth tutorial or reply would be appreciated, I also saw you're releasing a js wrapper so maybe that'll make it easier and I just need to be patient. Idk sorry this is just kind of a rant tbh I've been trying to get this to work for like 5 hours and can't get it
I rent an ECS and have installed and configured software. Is the following procedure correct?
Step 1, first operate: curl "http://*. *. *. *: 8088/client/register" - X GET
Step 2, operate again: curl "http://*. *. *: 8088/api/ask" - X POST -- header 'Authorization: sk111' - d '{"content": "Hello world"}'
Curl "http://*. *. *: 8088/client/register" - X GET, get the error prompt: Bad Request
How to solve it?
can anyone make an app for me by using chatgpt API.. prototype can be viewed here... its simple
Very complex to use and to install
Can you please make a video showing step by step with real example
I init the api in a docker container and the health check are correct but when I try to make an http request to the api/ask endpoint it gives me the error 503(Service unavailable). My code:
var response = await fetch(`${process.env.API_URL}/ask`, {
method: "POST",
headers: {
"content-type": "application/json",
Authorization: process.env.API_KEY,
},
body: JSON.stringify({
content: message,
}),
});
console.log(response);
var json = await response.json();
console.log(json.content);
return json.content;
API logs:
2022-12-28 18:20:50 chatgpt-api-server-chatgpt-api-server-1 | [GIN-debug] Listening and serving HTTP on :8080
2022-12-28 18:21:08 chatgpt-api-server-chatgpt-api-server-1 | [GIN] 2022/12/28 - 17:21:08 | 503 | 17.8269ms | 172.28.0.1 | POST "/api/ask"
2022-12-28 18:21:20 chatgpt-api-server-chatgpt-api-server-1 | [GIN] 2022/12/28 - 17:21:20 | 200 | 28.7µs | 127.0.0.1 | GET "/health"
2022-12-28 18:21:50 chatgpt-api-server-chatgpt-api-server-1 | [GIN] 2022/12/28 - 17:21:50 | 200 | 24.4µs | 127.0.0.1 | GET "/health"
2022-12-28 18:22:20 chatgpt-api-server-chatgpt-api-server-1 | [GIN] 2022/12/28 - 17:22:20 | 200 | 21.6µs | 127.0.0.1 | GET "/health"
2022-12-28 18:22:50 chatgpt-api-server-chatgpt-api-server-1 | [GIN] 2022/12/28 - 17:22:50 | 200 | 215.1µs | 127.0.0.1 | GET "/health"
Getting this error in Firefox on every request
Error: Request failed with status code: 429
fetchData moz-extension://d3c3bcf7-20e0-4b33-ba53-a5daa0abc2de/src/content.js:201
sendChatRequest moz-extension://d3c3bcf7-20e0-4b33-ba53-a5daa0abc2de/src/content.js:124
handleChatGptRequest moz-extension://d3c3bcf7-20e0-4b33-ba53-a5daa0abc2de/src/content.js:102
onmessage moz-extension://d3c3bcf7-20e0-4b33-ba53-a5daa0abc2de/src/content.js:38
onopen moz-extension://d3c3bcf7-20e0-4b33-ba53-a5daa0abc2de/src/content.js:26
EventHandlerNonNull* moz-extension://d3c3bcf7-20e0-4b33-ba53-a5daa0abc2de/src/content.js:24
promise callback* moz-extension://d3c3bcf7-20e0-4b33-ba53-a5daa0abc2de/src/content.js:6
when I input the conversation_id, it give back the error "{"error":"No available clients"}"
Hello, I'm reading the instructions, but am confused on how/where to use this. "Go" is already installed and so is "github.com/ChatGPT-Hackers/ChatGPT-API-server@latest", but where do you move on from there? I am not familiar with this process at all and have no idea how to proceed furthermore. A tutorial would be appreciated.
I am running this inside a docker and it gives me this error however if I put gcc -v it says that I have the version 10.3
Install the server and agent base on the tutorial:
the server shows:
seems it get connected. and I use the :
curl "http://192.168.xxx.xxx:8080/api/ask" -X POST --header 'Authorization: xxxxxxxxxx ' -d '{"content": "Hello world", "conversation_id": "d9e0d2a5-c8f3-4129-8e47-95b2a202d915", "parent_id": "836be1c1-6fe8-4a5a-b37a-0f8ab7cd2ea0"}'
it shows:
{"error":"No available clients"}
What and where should I debug for ?
What is the apikey
here?
such as : Bearer eyJhxxxxxxx?
I ran go install github.com/ChatGPT-Hackers/ChatGPT-API-server@latest
and this error pops up while installing:
`go: downloading github.com/ChatGPT-Hackers/ChatGPT-API-server v0.0.0-20221224161403-936a75057ee7
../../go/pkg/mod/golang.org/x/[email protected]/http2/frame.go:17:39: error: import error for ‘.golang.org/x/net/http/httpguts.headerValueContainsToken’: lookup of ‘$ret6’ failed
17 | "golang.org/x/net/http/httpguts"
| ^
../../go/pkg/mod/golang.org/x/[email protected]/http2/frame.go:17:39: error: unrecognized binary operator
/home/getxd/go/pkg/mod/golang.org/x/[email protected]/http/httpguts/httplex.go:142: error: not enough arguments to return
/home/getxd/go/pkg/mod/golang.org/x/[email protected]/http/httpguts/httplex.go:144: error: not enough arguments to return
`
The ChatGPT service is currently used on a machine in Singapore. How to play proxy in linux server environment? How do you combine agent and ChatGPT
I think we can add default number of retry to each incoming request to /api/ask
endpoint. Instead of returning Content-Type: 'application/json'
we could return Content-Type: 'text/event-stream'
. With this change it might be slightly slower than the original but we would at least try at least 3 times with different agents from connection pool.
For example, proposed change:
/api/ask
endpoint content type would be text/event-stream
instead of application/json
:
curl "http://localhost:8080/api/ask" -X POST --header 'Authorization: <API_KEY>' -d '{"content": "Hello world"}'
default minimum retry # is 3.
In this example /api/ask
endpoint failed with first two agent and was successful at the third one.
data: retry #1 failed.
data: retry #2 failed.
data: {"message": { ... }, "conversation_id": " ... "}
data: [DONE]
I believe this would utilize the connection pool even better.
First of all, sorry for my ignorance.
I haven't clear the propose of this server, I was expecting a server API to can request directly to it the asking sentences in the same way the official webpage does to their backend, but I don't see any reference to chat.openai.com/backend-api
endpoints in the code.
Looks like it is built to synchronize with an Agent somehow? Why then it is necessary? I'm missing many things.
Could you explain me more in detal how is it supposed to work? Always with an Agent? what's the role of this server? I would appreciate it so much :)
can you add text/event-stream support for /api/ask? So that client can get response as soon as possible, and the response will act as the offical website
Context: I have the server running as a container in GCP cloud run, and am using the Mozilla agent
Problem: It seems to work for a few requests, but then quickly after I'm not sure exactly what happens but every request hangs and doesn't return anything. When there's no client connected often it will return no client connected, but once it correctly has a connection, everything hangs. In terms of errors, it's usually no error, or a 503. In addition, sometimes there's a correctly registered connection, but when a request comes in to /api/ask, it returns "No client connected".
I manually created auth.db under the Data folder and still got Failed to create database. Neither the administrator can run cmd nor the powershell administrator can run it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.