Before submitting your bug report
Relevant environment info
- OS: macOS
- Continue version: > 1.2.11
- IDE version: VSCode 1.114
- Model: gemini
- config:
name: Gemini
version: 1.0.0
models:
- name: Gemini Flash
provider: gemini
model: gemini-2.5-flash
apiBase: https://example.com/v1/streaming-models/locations/europe-west4/publishers/google # region can be adjusted (all european regions are possible)
apiKey: <api-key>
requestOptions:
headers:
x-api-key: <api-key>
Content-Type: application/json
verifySsl: true
caBundlePath: "ca-bundle.crt"
roles:
- apply
- chat
- edit
defaultCompletionOptions: # optional
contextLength: 1048576
maxTokens: 65536
Description
The API we are using still uses the API-Header x-api-key instead of x-goog-api-key. But configuring the header as shown above does not send it to the gemini API.
It seems that the code in the gemini-Extension here sends two hard-coded headers but not custom ones.
Can you please extend the code such that it also sends custom header configured in config.yaml?
Thanks in advance.
To reproduce
- Use the above configuration with a valide API key
- Try to chat with gemini
You will get the following error message:
{"error":{"message":"{\n \"error\": {\n \"code\": 400,\n \"message\": \"API key not valid. Please pass a valid API key.\",\n \"status\": \"INVALID_ARGUMENT\",\n \"details\": [\n {\n \"@type\": \"type.googleapis.com/google.rpc.ErrorInfo\",\n \"reason\": \"API_KEY_INVALID\",\n \"domain\": \"googleapis.com\",\n \"metadata\": {\n \"service\": \"generativelanguage.googleapis.com\"\n }\n },\n {\n \"@type\": \"type.googleapis.com/google.rpc.LocalizedMessage\",\n \"locale\": \"en-US\",\n \"message\": \"API key not valid. Please pass a valid API key.\"\n }\n ]\n }\n}\n","code":400,"status":"Bad Request"}}
Log output
{"error":{"message":"{\n \"error\": {\n \"code\": 400,\n \"message\": \"API key not valid. Please pass a valid API key.\",\n \"status\": \"INVALID_ARGUMENT\",\n \"details\": [\n {\n \"@type\": \"type.googleapis.com/google.rpc.ErrorInfo\",\n \"reason\": \"API_KEY_INVALID\",\n \"domain\": \"googleapis.com\",\n \"metadata\": {\n \"service\": \"generativelanguage.googleapis.com\"\n }\n },\n {\n \"@type\": \"type.googleapis.com/google.rpc.LocalizedMessage\",\n \"locale\": \"en-US\",\n \"message\": \"API key not valid. Please pass a valid API key.\"\n }\n ]\n }\n}\n","code":400,"status":"Bad Request"}}
Before submitting your bug report
Relevant environment info
Description
The API we are using still uses the API-Header
x-api-keyinstead ofx-goog-api-key. But configuring the header as shown above does not send it to the gemini API.It seems that the code in the gemini-Extension here sends two hard-coded headers but not custom ones.
Can you please extend the code such that it also sends custom header configured in
config.yaml?Thanks in advance.
To reproduce
You will get the following error message:
{"error":{"message":"{\n \"error\": {\n \"code\": 400,\n \"message\": \"API key not valid. Please pass a valid API key.\",\n \"status\": \"INVALID_ARGUMENT\",\n \"details\": [\n {\n \"@type\": \"type.googleapis.com/google.rpc.ErrorInfo\",\n \"reason\": \"API_KEY_INVALID\",\n \"domain\": \"googleapis.com\",\n \"metadata\": {\n \"service\": \"generativelanguage.googleapis.com\"\n }\n },\n {\n \"@type\": \"type.googleapis.com/google.rpc.LocalizedMessage\",\n \"locale\": \"en-US\",\n \"message\": \"API key not valid. Please pass a valid API key.\"\n }\n ]\n }\n}\n","code":400,"status":"Bad Request"}}Log output
{"error":{"message":"{\n \"error\": {\n \"code\": 400,\n \"message\": \"API key not valid. Please pass a valid API key.\",\n \"status\": \"INVALID_ARGUMENT\",\n \"details\": [\n {\n \"@type\": \"type.googleapis.com/google.rpc.ErrorInfo\",\n \"reason\": \"API_KEY_INVALID\",\n \"domain\": \"googleapis.com\",\n \"metadata\": {\n \"service\": \"generativelanguage.googleapis.com\"\n }\n },\n {\n \"@type\": \"type.googleapis.com/google.rpc.LocalizedMessage\",\n \"locale\": \"en-US\",\n \"message\": \"API key not valid. Please pass a valid API key.\"\n }\n ]\n }\n}\n","code":400,"status":"Bad Request"}}