Skip to main content

Documentation Index

Fetch the complete documentation index at: https://ngrok.com/docs/llms.txt

Use this file to discover all available pages before exploring further.

Google AI Studio provides Gemini models. Google requires you to bring your own key—ngrok-managed keys are not available for Google.

Attach your key

Attach your Google key to your AI Gateway API Key. ngrok encrypts and stores it server-side, so clients only ever send your AI Gateway API Key.
1

Create an AI Gateway endpoint

If you don’t have one yet, follow the quickstart to create your AI Gateway endpoint with an AI Gateway API Key.
2

Get a Google AI API key

Generate an API key at aistudio.google.com. Keys are available on the free tier.
3

Attach the key

ngrok api ai-gateway-provider-keys create \
  --ai-gateway-api-key-id aigk_xxxxx \
  --provider-id google \
  --description "My Google Key" \
  --value AIza...
4

Make a request

Use your AI Gateway API Key—the gateway resolves the Google key server-side.
from openai import OpenAI

client = OpenAI(
    base_url="https://your-ai-gateway.ngrok.app/v1",
    api_key="ng-xxxxx-g1-xxxxx"  # Your AI Gateway API Key
)

response = client.chat.completions.create(
    model="gemini-2.5-flash",
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)
See Attaching Provider Keys for key rotation, listing, and removing attached keys.

Available models

See the model catalog for the full list of supported Gemini models.

Next steps