Skip to content

AI agent won't accept API key #1514

Description

@Ben-ADFA

Ref. 4684

Multiple users have reported this problem:

From MAKHLWF (@makhlwf) on Telegram:
https://t.me/CodeOnTheGoDiscussions/6733
"I have located the AI agent; however, I am encountering difficulties when attempting to insert my Gemini API key, as it does not appear to be saving. I am consistently receiving a 400 error. The error message states: "400 BAD_REQUEST. A client-side error occurred. This is often due to an invalid API key (e.g., with extra spaces or newlines) or a malformed request. Please check your configuration and credentials."

I am uncertain whether the application is receiving the accurate API key. I attempted to input "hello" into the API key field and save it. When I attempt to edit it, check and uncheck the "show" option in the Heading text area (which is the API key), it does not function correctly. It consistently displays as if I am inputting 20 characters. I will provide an image here for you to view as an example. How can I verify if the application is saving my accurate Gemini API key? Additionally, the application does not seem to allow me to select a specific model. Do you know which model is currently running using my API key?"

Images:
Image

Image Image Image

https://t.me/CodeOnTheGoDiscussions/6741
"As evidenced by the aforementioned screenshots, the input of "high" served as an illustrative example to demonstrate that API keys are replaced by a placeholder consisting of 20 random characters. This masking occurs regardless of the visibility toggle setting. However, when a valid API key is entered or pasted as plain text, the same error persists without an identifiable cause."

User specs:
Xiaomi Poco X5 Pro 5G running the latest stable version of Android 14

From Basheer Ali (@BasheeraliBHR) on Telegram:
https://t.me/CodeOnTheGoDiscussions/6744
"Problem: 400 BAD_REQUEST error when sending messages through the Gemini model in the Code on the Go (COTG Engine) application.

Displayed error message:

«An error occurred: 400 BAD_REQUEST. A client-side error occurred. This is often due to an invalid API key (e.g., with extra spaces or newlines) or a malformed request. Please check your configuration and credentials.»

Current status and troubleshooting performed:

  • Application status: The Gemini API key has been entered and saved in the application's settings. However, when switching to the Agent tab and sending any message, the application immediately stops responding and displays the error message above.
  • Network and regional access: The network connection is working properly, and there are no geographic restrictions or blocking issues.
  • API key status: The API key is valid and was created and activated approximately 24 hours ago.
  • External verification: I also tested the API outside the application using Termux with the following command:

curl -H 'Content-Type: application/json'
-d '{"contents":[{"parts":[{"text":"Hello"}]}]}'
-X POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key'

The result was exactly the same error message.

Has anyone encountered this issue before or knows how to enable/configure this feature correctly? Any help or guidance would be greatly appreciated."

User's specs:
My phone model: Samsung Note 10 Plus 5G
Android version: 12
App version: CodeOnTheGo-release26.28-armv8a.apk

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions