-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Application unable to accept GPT API key #77
Comments
Hi @johmicrot, thanks for reporting the issue. Have you tried installing the PyPI package pip install readmeai --upgrade
export OPENAI_API_KEY="your-api-secret-key"
readmeai -r <repository-url> Thank you, |
@johmicrot one other thing to check, if you manually cloned the repo and are using conda, you need to use the command below to run the program: python3 -m readmeai.cli.commands -r <repository-url> Using the See the project's README - running readme-ai section for more details on how to run the tool. Thank you, |
Sorry I meant to mention that i did also try it with pip using the commands you specified (outside of conda), and the I should have specified that it does generate the report, but it seems to be equivalent to the offline report. |
@johmicrot in your docker command are you setting the api key as For example, you can try running the following on one of my example repos. docker pull zeroxeli/readme-ai:latest
export OPENAI_API_KEY="your-api-secret-key"
docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY -v "$(pwd)":/app zeroxeli/readme-ai:latest readmeai -o readme-ai.md -r https://github.com/eli64s/readmeai-ui Also have you tried creating a new api key on OpenAI's site? |
@eli64s, I have created a new API specifically for this demo. I've executed all of the commands you provided, and actually i get a new error! After pulling the latest image, exporting the key, and running the following docker command
So it appears something with the latest push broke it in my system. Some possible causes that I'm aware of : Mismatched Architecture, Corrupted Image, Incorrect Shebang in Script (e.g. If /home/tempuser/.local/bin/readmeai is a script, it might have an incorrect shebang line), or possibly Binary Built for Different OS. I pulled the repository and build the image on my system with then I run it with I get the same error, but here i'll provide the full output of the error
|
@johmicrot The application uses gpt-4-1106-preview, which is not available for free accounts. To resolve this, either upgrade to a paid account or use the sudo docker run -it -e OPENAI_API_KEY=$OPENAI_API_KEY rmai readmeai -o readme-ai.md -r https://github.com/eli64s/readmeai-ui -m gpt-3.5-turbo-1106 |
@Ashu0Singh No, i actually have a paid account. Interestingly when i specify Then when i specify I just realized the error "You didn't provide an API key" I see when clicking on the "https://api.openai.com/v1/chat/completions" is actually not related to the run I just made, it is the HTTP error for clicking on the link. But the two errors above still stand. |
@johmicrot I was able to replicate the error you're facing, and it seems to be specific to Docker. You can try resolving it without Docker using the following steps: pip install readmeai
export OPENAI_API_KEY=YOURAPIKEY
readmeai -o readme-ai.md -r https://github.com/eli64s/readmeai-ui -m gpt-3.5-turbo-1106 Note: While this might work for small files, it might encounter issues with large files due to token size limitations. For the rate limit error, the issue could be:
Refer to the OpenAI documentation on rate limits for more information. The second error can be resolved by using the CLI version instead of docker. pip install readmeai
export OPENAI_API_KEY=YOURAPIKEY
readmeai -o readme-ai.md -r https://github.com/eli64s/readmeai-ui -m gpt-4-1106-preview Note: Consider using gpt-4 instead of gpt-4-1106-preview as the latter incurs higher costs. After just 2 runs, I incurred $1.6 in usage. |
While I do have a paid account, i was sill somehow under the "free tier". I pay 20 a month for gpt4, but somehow I just had to put $5 on to my account to get the gpt-3.5-turbo-1106 model to work. The latest update has the requirements.txt version pinned, perhaps that also fixed a previous error I had. Closing the issue. @Ashu0Singh thanks for the heads up about the usage, even with the gpt-3.5-turbo-1106 model I've quickly used up $ 0.39 |
@johmicrot Yeah, that's because ChatGPT and OpenAI works with two different account. If you have signed up for GPT-4 that doesn't means that you have a tier one account. You'll need to add billing info separately for both of them. |
Thanks for helping out @Ashu0Singh! |
Perhaps this is related to issue #76 , but I am unable to get the application to recognise my paid API key. I've attempted with both docker and conda. I'm on Ubuntu 22.04.3 with python 3.9.18
Using Docker
sudo docker run -it -e OPENAI_API_KEY=Key_went_here -v "$(pwd)":/app zeroxeli/readme-ai:latest readmeai -o readme-ai.md -r Repo_went_here
Using Conda
First
export OPENAI_API_KEY=YOUR_API_KEY
Then
conda create -n readmeai python=3.9
and I enter the conda enviornment with
source activate readmeai
and install requirements.txt with
pip install -r requirements.txt
Finally running the application with
readmeai --output readme-ai.md --repository Repo_goes_here
Both implementations give me
"ERROR HTTPStatus Exception:
Client error '404 Not Found' for url 'https://api.openai.com/v1/chat/completions'
For more information check: https://httpstatuses.com/404
with the link saying
"{
"error": {
"message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}"
I even tried to modify the https://github.com/eli64s/readme-ai/blob/4cc83dc49e0f5bf3b304d504394a9adf7c028acb/readmeai/core/model.py#L176C1-L176C75 to directly include my API key as a string, but this did not fix the issue.
The text was updated successfully, but these errors were encountered: