Model Providers
Google AI Studio (Gemini API)
Call Gemini text models with a Google AI Studio API key through your Verdictan gateway. Your application sends an OpenAI-style Chat Completions request, and the gateway translates it to the Gemini API and translates the reply back.
To use Google Cloud IAM credentials instead of an API key, see Google Vertex AI.
Before you start
- A working gateway from the quickstart.
- A Google AI Studio API key, and one Gemini model ID that the key can use.
- The gateway startup command, and a separate application token for test requests.
Configure the provider
Keep provider_type and format as shown. verdictan policy lint uses provider_type to check secret_key_ref.
pack:
name: google-ai-studio-integration
version: 1.0.0
enabled: true
policies:
chain:
- prompt-injection
providers:
targets:
- id: google-ai-studio-primary
provider: google-ai-studio
provider_type: google-ai-studio
format: google-gemini
model: "replace-with-gemini-model-id"
base_url: https://generativelanguage.googleapis.com
secret_key_ref:
env: VERDICTAN_GOOGLE_AI_STUDIO_API_KEYThe gateway sends each request to /v1beta/models/{model}:generateContent and puts the key from VERDICTAN_GOOGLE_AI_STUDIO_API_KEY in the x-goog-api-key header.
Start and verify
You can publish the Google AI Studio target with CLI 0.1.14 or later. Check In sync before the non-streaming request below. That request also checks provider access.
With the quickstart in Docker, follow the container steps instead of steps 1 to 3.
-
In the gateway terminal, set the key and lint the file:
export VERDICTAN_GOOGLE_AI_STUDIO_API_KEY="<provider-api-key>" verdictan policy lint --file policy-config.yaml -
Restart the test gateway with the key in its environment.
-
Deploy the file to the test agent in Configurations. If that agent already runs
pack.version1.0.0, increase the version first. Then wait for the gateway log lineconnected read model refresh applied updated configwith your version asconfig_version. Try the change on a test gateway has the steps. -
In a second terminal, send a non-streaming request for the configured model:
export VERDICTAN_CLIENT_TOKEN="<application-token>" curl --fail-with-body http://127.0.0.1:41002/v1/chat/completions \ -H "Authorization: Bearer ${VERDICTAN_CLIENT_TOKEN}" \ -H "Content-Type: application/json" \ -d '{"model":"replace-with-gemini-model-id","stream":false,"messages":[{"role":"user","content":"Reply with Hello."}]}'
choices[0].message.content contains the reply, and the request appears in History when capture is on, or in the delivered events.
Supported requests
| Request | Support |
|---|---|
Chat Completions, text, stream: false | Yes. Messages and common generation settings are translated to Gemini generateContent. |
| Streaming | Not recommended. Gemini stream frames are not fully translated to the OpenAI stream shape. |
| Messages | Not tested with this adapter |
Tools, image input, Responses, embeddings, response_format | No |
Failure behavior
| Problem | What to check |
|---|---|
401 from the gateway | The application token is active, and the key is set on the gateway host. |
| Provider authentication error | VERDICTAN_GOOGLE_AI_STUDIO_API_KEY is set in the gateway process. Restart the gateway. |
policy lint rejects secret_key_ref | provider_type: google-ai-studio is present. |
| Model not found | The Gemini model ID matches the target, and your key can use it. |
| Broken output in a streaming client | Send stream: false. |
Provider 429 or another upstream error | The response body and your Gemini API quota. See Error Handling. |
Limits
- Model names, prices, rate limits, and data terms are in the Gemini API documentation.
- The translation covers text messages and common generation settings. Other OpenAI request fields can be dropped.
- A listener on a non-loopback address needs TLS and network controls.
Next steps
- Google Vertex AI: Gemini through a Google Cloud project with IAM credentials.
- Provider Configuration: target fields, routing, and fallback.