Teakinboyewa / SpatialAnalysisAgent

GNU General Public License v3.0
33 stars 9 forks source link

model_not_found #17

Open ausiasrt opened 1 week ago

ausiasrt commented 1 week ago

Hi and thanks for your work. I get this error when I send a request: Error: Error code: 404 - {'error': {'message': 'The modelgpt-4does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}} Same error for model gpt-4o.

And I got this error for gpt-4o-mini: Error: Error code: 429 - {'error': {'message': 'You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.', 'type': 'insufficient_quota', 'param': None, 'code': 'insufficient_quota'}}

I am using a free account of OpenAI. Tested on QGIS 3.22.16-Białowieża on Debian 12. Thanks.

CharlesGag commented 1 week ago

Same thing, but using a business account., QGIS 3.40 thought.

yumemio commented 4 days ago

Hi @ausiasrt @CharlesGag ,

The error message suggests the API key is either invalid, not configured or does not have enough credits. As this section of the user manual describes, you need to configure the API key settings before using this plugin.

The OpenAI API quickstart explains how to set up an API key.

Notes:

  1. Unless your account is eligible for monthly billing, you need to purchase credits before you use the API key. Note that OpenAI API is a separate service from ChatGPT - regardless of your ChatGPT subscription status, you need to have some credits in your deposit (as far as I'm aware, there is no "free" version of the OpenAI API)
  2. The key should at lease have the write permission for "Model capabilities" (or you can set up an unrestricted API key)

To check if your key works, run the following command (source, see the documentation if curl is not available):

$ export OPENAI_API_KEY="your_api_key_here"
$ curl "https://api.openai.com/v1/chat/completions" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $OPENAI_API_KEY" \
    -d '{
        "model": "gpt-4o-mini",
        "messages": [
            {
                "role": "system",
                "content": "You are a helpful assistant."
            },
            {
                "role": "user",
                "content": "Write a haiku that explains the concept of recursion."
            }
        ]
    }'

Thanks!

Teakinboyewa commented 3 days ago

Thank you @yumemio for your response!

@ausiasrt and @CharlesGag, please be sure you are using correct API key. Let me know if you are able to solve this issue