can't use groq
What happened?
Connection failed.
Incorrect API key provided: $CUSTOM_***********_KEY. You can find your API key at https://platform.openai.com/account/api-keys.
Relevant log output or stack trace
No response
Steps to reproduce
-
get api key from https://groq.com/
-
on codegpt setting,
- select custom openai service
- select 'Groq' on preset template
- input api key
- click test connection
the error below occurred
Connection failed.
Incorrect API key provided: $CUSTOM_***********_KEY. You can find your API key at
https://platform.openai.com/account/api-keys.
when I tested on curl below, it's working fine.
curl -X POST "https://api.groq.com/openai/v1/chat/completions" \
-H "Authorization: Bearer $GROQ_API_KEY" \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user", "content": "Explain the importance of fast language models"}], "model": "mixtral-8x7b-32768"}'
CodeGPT version
2.6.3-241
Operating System
macOS
The error message indicates that 1) you're talking to openai.com, and 2) you're sending the literal string $CUSTOM_SERVICE_API_KEY as your api-key.
Can you verify that you have configured an custom URL and api-key in your CodeGPT plugin settings?
when I select 'Groq' on preset template.
it changes the URL to https://api.groq.com/openai/v1/chat/completions automatically. I used the url
Did you apply the settings before testing the connection? There's a small bug around that.
the settings I mentioned above is applied before testing the connection
Same here since #476 has been merged, the wrong settings are being used for Custom OpenAI, depending on your application state.
If you switch presets, the default settings are being applied (Ollama has no code completions, tab is disabled).
If you reopen the settings dialog again, code completions becomes active with default settings for OpenAI (first FIM template autoselected), hence the Incorrect API key provided response for platform.openai.com (Ollama runs on localhost).
So the user settings are being overwritten sometimes with "default values" or empty values depending on Preset template change, FIM template change, open settings dialog (init forms)...
This feature is very flaky, I would suggest writing tests first for all supported services, models and FIM templates (success and errors like missing API key, unexpected API key, unexpected response). And especially changing user settings without the user knowing it, initializing forms shouldn't change persisted users settings but instead load them, but many more settings are changed/deleted/added depending on the selected Preset and FIM.
Maybe it would be helpful if the listener would be usable with checked exceptions instead of RuntimeExceptions, so the application would have to handle all errors explicitly.
Incorrect API key provided: $CUSTOM_***********_KEY. You can find your API key at https://platform.openai.com/account/api-keys.
java.lang.RuntimeException
at ee.carlrobert.llm.completion.CompletionEventSourceListener.onFailure(CompletionEventSourceListener.java:114)
at okhttp3.internal.sse.RealEventSource.processResponse(RealEventSource.kt:52)
thanks for the solution. but, I couldn't understand the detail.
- can it be fixed?
- is there workaround before it's fixed?
Never open settings again before the next CodeGPT release 😅 Before closing settings, make sure to switch the Preset template first and check all settings to be correct.
@dss99911
is there workaround before it's fixed?
Delete CodeGPT_CustomServiceSettings.xml settings file from the options folder and restart your IDE.
https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs
This is fixed by https://github.com/carlrobertoh/CodeGPT/pull/531