Copilot to OpenAI API
GET /v1/models
: Get model listPOST /v1/chat/completions
: Chat APIPOST /v1/embeddings
: Text Embedding
- ⚠RECOMMEND: Sign up a new free account and ⚠DO NOT use paid account
- Run Get-token and open this URL to get long term token.
- Open this to enable copilot
- Save this token and use in client app
- Run the server app or Docker
docker pull patchescamera/copilot2api:latest # AOT compilation based on Graalvm
docker run -d -p 8080:80 patchescamera/copilot2api:latest
docker pull patchescamera/copilot2api:java
docker run -d -p 8080:80 patchescamera/copilot2api:java
curl -X POST http://127.0.0.1:8080/v1/chat/completions \
-H "Authorization: Bearer <Bearer>" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [
{"role": "user", "content": "Hello?"}
],
"temperature": 0.7,
"max_tokens": 1024,
"stream": false
}'
sudo apt update
sudo apt install -y libssl-dev pkg-config cargo
cargo build --release
Run
./target/release/Get-Token
- The program will automatically save the token to SQlite's token.db. Next time, if the client does not provide a token, a random token in tokens.db will be used.
- Image input/generation is not supported.
- All tokens passed in will be recorded in tokens.db. Do not pass in invalid tokens.
- When
GET /v1/models
does not receive a valid Bearer request header, a random bearer in tokens.db will be used. If there is no record in tokens.db, the default JSON will be returned. - The o1 series models do not support streaming. If stream is true, this program only simulates
- ⚠Please do not log in with a paid account. It is always recommended to log in with a free account. There is no guarantee that the account will not be banned.
- It is not recommended to run on public network
gpt-4o -> gpt-4o-2024-05-13
gpt-4-o-preview -> gpt-4o-2024-05-13
gpt-4o-2024-08-06 -> gpt-4o-2024-08-06
gpt-4 -> gpt-4-0613
gpt-4o-mini -> gpt-4o-mini-2024-07-18
gpt-4-0125-preview
gpt-3.5-turbo -> gpt-3.5-turbo-0613
o1 -> o1-2024-12-17
o1-mini -> o1-mini-2024-09-12
claude-3.5-sonnet
text-embedding-ada-002
text-embedding-3-small-inference -> text-embedding-3-small