Access Gemini through custom baseURL #3655

Closed
opened 2026-02-16 17:41:01 -05:00 by yindo · 3 comments
Owner

Originally created by @exAClior on GitHub (Dec 18, 2025).

Question

Will it be possible to do so? I tried the following setup in opencode.json but failed with error text part d947b8ac-fbc7-41df-8720-fe6a5eda1645 not found.

	    "my-gemini":{
					"npm": "ai-sdk-provider-gemini-cli",
					"name": "My Gemini",
					"options":{
						"authType": "api-key",
					    "baseURL": "https://random-api-endpoint.com/gemini",
						"apiKey": "{env:GEMINI_API_KEY}"
					},
					"models": {
					  "gemini-3-pro-preview": {
							"name": "Gemini 3 Pro Preview",
						}
					}

		}
Originally created by @exAClior on GitHub (Dec 18, 2025). ### Question Will it be possible to do so? I tried the following setup in `opencode.json` but failed with error `text part d947b8ac-fbc7-41df-8720-fe6a5eda1645 not found`. ```json "my-gemini":{ "npm": "ai-sdk-provider-gemini-cli", "name": "My Gemini", "options":{ "authType": "api-key", "baseURL": "https://random-api-endpoint.com/gemini", "apiKey": "{env:GEMINI_API_KEY}" }, "models": { "gemini-3-pro-preview": { "name": "Gemini 3 Pro Preview", } } } ```
yindo closed this issue 2026-02-16 17:41:01 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 18, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #5674: Custom OpenAI-compatible provider options not being passed to API calls
  • #5163: Custom baseURL configuration returns error

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Dec 18, 2025): This issue might be a duplicate of existing issues. Please check: - #5674: Custom OpenAI-compatible provider options not being passed to API calls - #5163: Custom baseURL configuration returns error Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Dec 18, 2025):

what provider is that? why not use the ai-sdk/google?

@rekram1-node commented on GitHub (Dec 18, 2025): what provider is that? why not use the ai-sdk/google?
Author
Owner

@exAClior commented on GitHub (Dec 18, 2025):

Thank you so much! You are the champion! Issue resolved! It's a custom relay service for protection of geolocation information.

For the record, the following config works for me

        "my-gemini":{
            "npm": "@ai-sdk/google",
            "name": "My Gemini",
            "options":{
                "baseURL": "https://some_url/gemini/v1",
                "apiKey": "{env:GEMINI_API_KEY}"
            },
            "models": {
                "gemini-3-pro-preview": {
                    "name": "Gemini 3 Pro Preview",
                }
            }
        },
@exAClior commented on GitHub (Dec 18, 2025): Thank you so much! You are the champion! Issue resolved! It's a custom relay service for protection of geolocation information. For the record, the following config works for me ```json "my-gemini":{ "npm": "@ai-sdk/google", "name": "My Gemini", "options":{ "baseURL": "https://some_url/gemini/v1", "apiKey": "{env:GEMINI_API_KEY}" }, "models": { "gemini-3-pro-preview": { "name": "Gemini 3 Pro Preview", } } }, ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3655