> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google AI

> Route Google Gemini model requests through Orq.ai's AI Gateway. Set up your Google AI Studio API key for chat, embedding, and multimodal models.

## Setup Your API Key

To use Google AI with Orq.ai, follow these steps:

1. Navigate to **AI Gateway** > BYOK
2. Find **Google AI** in the list
3. Click the **Configure** button next to Google AI
4. In the modal that opens, select <kbd className="key">Setup your own API Key</kbd>
5. Enter a name for this configuration (e.g., "Google AI Production")
6. Paste your Google AI API Key into the provided field
7. Click **Save** to complete the setup

Your Google AI API key is now configured and ready to use with Orq.ai in **AI Studio** or through the **AI Gateway**.

## Available Models

The **AI Gateway** supports all current Google Gemini models. Here are the most commonly used:

### Recommended Models

| Model                                          | Context | Best For                                        |
| ---------------------------------------------- | ------- | ----------------------------------------------- |
| `google-ai/gemini-3.1-pro-preview`             | 1M      | Latest Gemini 3.1, most advanced (experimental) |
| `google-ai/gemini-3.1-pro-preview-customtools` | 1M      | Gemini 3.1 with custom tools support            |
| `google-ai/gemini-3.1-flash-lite-preview`      | 1M      | Cost-efficient Gemini 3.1 inference             |
| `google-ai/gemini-2.5-pro`                     | 1M      | Latest stable, most capable                     |
| `google-ai/gemini-2.5-flash`                   | 1M      | Fast, balanced performance                      |
| `google-ai/gemini-2.5-flash-lite`              | 1M      | Lightweight, cost-effective                     |

<AccordionGroup>
  <Accordion title="View all Google Gemini models" icon="google">
    #### Latest Generation (Gemini 3.1: Preview)

    * `google-ai/gemini-3.1-pro-preview`: Latest Gemini 3.1, most advanced
    * `google-ai/gemini-3.1-pro-preview-customtools`: Gemini 3.1 with custom tools support
    * `google-ai/gemini-3.1-flash-lite-preview`: Cost-efficient inference, Flash Lite variant

    #### Current Generation (Gemini 2.5)

    * `google-ai/gemini-2.5-pro`: Latest stable, most capable
    * `google-ai/gemini-2.5-flash`: Fast, balanced performance
    * `google-ai/gemini-2.5-flash-lite`: Lightweight, cost-effective
    * `google-ai/gemini-2.5-flash-preview-09-2025`: Flash preview
    * `google-ai/gemini-2.5-flash-lite-preview-09-2025`: Lite preview

    #### Stable Generation (Gemini 2.0)

    * `google-ai/gemini-2.0-flash`: Stable, reliable
    * `google-ai/gemini-2.0-flash-001`: Specific version
    * `google-ai/gemini-2.0-flash-lite`: Lightweight variant
    * `google-ai/gemini-2.0-flash-lite-001`: Lite specific version
    * `google-ai/gemini-2.0-flash-lite-preview-02-05`: Preview version

    #### Latest Versions

    * `google-ai/gemini-flash-latest`: Latest flash model
    * `google-ai/gemini-flash-lite-latest`: Latest lite model

    For a complete and up-to-date list of all available Google Gemini models, see [Supported Models](/docs/ai-studio/ai-gateway/supported-models#chat-models).

    All models are available through the **AI Gateway** with the `google-ai/` prefix.
  </Accordion>
</AccordionGroup>

<Tip>
  Use `google-ai/gemini-3.1-pro-preview` for the latest preview, `google-ai/gemini-2.5-pro` for the latest stable model, or `google-ai/gemini-2.5-flash` for the best balance of performance and cost.
</Tip>

## Quick Start

Access Google Gemini models through the **AI Gateway**.

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST https://api.orq.ai/v3/router/responses \
    -H "Authorization: Bearer $ORQ_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "google-ai/gemini-2.5-pro",
      "input": "Explain quantum computing in simple terms"
    }'
  ```

  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.ORQ_API_KEY,
    baseURL: "https://api.orq.ai/v3/router",
  });

  const response = await client.responses.create({
    model: "google-ai/gemini-2.5-pro",
    input: "Explain quantum computing in simple terms",
  });

  console.log(response.output_text);
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from openai import OpenAI
  import os

  client = OpenAI(
      api_key=os.environ.get("ORQ_API_KEY"),
      base_url="https://api.orq.ai/v3/router",
  )

  response = client.responses.create(
      model="google-ai/gemini-2.5-pro",
      input="Explain quantum computing in simple terms",
  )

  print(response.output_text)
  ```

  ```typescript TypeScript (Chat Completions) theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.ORQ_API_KEY,
    baseURL: "https://api.orq.ai/v3/router",
  });

  const response = await client.chat.completions.create({
    model: "google-ai/gemini-2.5-pro",
    messages: [{ role: "user", content: "Explain quantum computing in simple terms" }],
  });

  console.log(response.choices[0].message.content);
  ```

  ```python Python (Chat Completions) theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from openai import OpenAI
  import os

  client = OpenAI(
      api_key=os.environ.get("ORQ_API_KEY"),
      base_url="https://api.orq.ai/v3/router",
  )

  response = client.chat.completions.create(
      model="google-ai/gemini-2.5-pro",
      messages=[{"role": "user", "content": "Explain quantum computing in simple terms"}],
  )

  print(response.choices[0].message.content)
  ```
</CodeGroup>

## Using the AI Gateway

Access Google Gemini models through the **AI Gateway** with advanced chat completions, streaming, and intelligent model routing. All Gemini models are available with consistent formatting and automatic request logging.

<Info>
  Google AI models use the provider slug format: `google-ai/model-name`. For example: `google-ai/gemini-2.5-pro`
</Info>

### Prerequisites

Before making requests to the **AI Gateway**, you need to configure your environment and install the SDKs if you choose to use them.

**Endpoint**

```
POST https://api.orq.ai/v3/router/responses
```

**Required Headers**

Include the following headers in all requests:

```
Authorization: Bearer $ORQ_API_KEY
Content-Type: application/json
```

**Getting your API Key:**

1. Go to [API Keys](/docs/ai-studio/organization/api-keys)
2. Click <kbd className="key">Create API Key</kbd> and copy it
3. Store it in your environment as `ORQ_API_KEY`

**SDK Installation**

Install the OpenAI SDK for your language (compatible with Google Gemini models):

<CodeGroup>
  ```bash Node.js/TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  npm install openai
  # or
  yarn add openai
  ```

  ```bash Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  pip install openai
  ```
</CodeGroup>

### Basic Usage

<Tip>
  If your OpenAI code is already functioning, you only need to change the `base_url` and `api_key` to the router endpoint and `ORQ_API_KEY`.
</Tip>

Send messages to Gemini models and get intelligent responses:

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST https://api.orq.ai/v3/router/responses \
    -H "Authorization: Bearer $ORQ_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "google-ai/gemini-2.5-pro",
      "input": "Explain machine learning"
    }'
  ```

  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.ORQ_API_KEY,
    baseURL: "https://api.orq.ai/v3/router",
  });

  const response = await client.responses.create({
    model: "google-ai/gemini-2.5-pro",
    input: "Explain machine learning",
  });

  console.log(response.output_text);
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from openai import OpenAI
  import os

  client = OpenAI(
      api_key=os.environ.get("ORQ_API_KEY"),
      base_url="https://api.orq.ai/v3/router",
  )

  response = client.responses.create(
      model="google-ai/gemini-2.5-pro",
      input="Explain machine learning",
  )

  print(response.output_text)
  ```

  ```typescript TypeScript (Chat Completions) theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.ORQ_API_KEY,
    baseURL: "https://api.orq.ai/v3/router",
  });

  const response = await client.chat.completions.create({
    model: "google-ai/gemini-2.5-pro",
    messages: [{ role: "user", content: "Explain machine learning" }],
  });

  console.log(response.choices[0].message.content);
  ```

  ```python Python (Chat Completions) theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from openai import OpenAI
  import os

  client = OpenAI(
      api_key=os.environ.get("ORQ_API_KEY"),
      base_url="https://api.orq.ai/v3/router",
  )

  response = client.chat.completions.create(
      model="google-ai/gemini-2.5-pro",
      messages=[{"role": "user", "content": "Explain machine learning"}],
  )

  print(response.choices[0].message.content)
  ```
</CodeGroup>

#### Streaming

Stream responses for real-time output and improved user experience:

<CodeGroup>
  ```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST https://api.orq.ai/v3/router/responses \
    -H "Authorization: Bearer $ORQ_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "google-ai/gemini-2.5-pro",
      "input": "Write a short poem about the ocean",
      "stream": true
    }'
  ```

  ```typescript TypeScript theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.ORQ_API_KEY,
    baseURL: "https://api.orq.ai/v3/router",
  });

  const stream = await client.responses.create({
    model: "google-ai/gemini-2.5-pro",
    input: "Write a short poem about the ocean",
    stream: true,
  });

  for await (const event of stream) {
    if (event.type === "response.output_text.delta") {
      process.stdout.write(event.delta);
    }
  }
  ```

  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from openai import OpenAI
  import os

  client = OpenAI(
      api_key=os.environ.get("ORQ_API_KEY"),
      base_url="https://api.orq.ai/v3/router",
  )

  stream = client.responses.create(
      model="google-ai/gemini-2.5-pro",
      input="Write a short poem about the ocean",
      stream=True,
  )

  for event in stream:
      if event.type == "response.output_text.delta":
          print(event.delta, end="", flush=True)
  ```

  ```typescript TypeScript (Chat Completions) theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.ORQ_API_KEY,
    baseURL: "https://api.orq.ai/v3/router",
  });

  const stream = await client.chat.completions.create({
    model: "google-ai/gemini-2.5-pro",
    messages: [{ role: "user", content: "Write a short poem about the ocean" }],
    stream: true,
  });

  for await (const chunk of stream) {
    process.stdout.write(chunk.choices[0]?.delta?.content || "");
  }
  ```

  ```python Python (Chat Completions) theme={"theme":{"light":"github-light","dark":"github-dark"}}
  from openai import OpenAI
  import os

  client = OpenAI(
      api_key=os.environ.get("ORQ_API_KEY"),
      base_url="https://api.orq.ai/v3/router",
  )

  stream = client.chat.completions.create(
      model="google-ai/gemini-2.5-pro",
      messages=[{"role": "user", "content": "Write a short poem about the ocean"}],
      stream=True,
  )

  for chunk in stream:
      if chunk.choices[0].delta.content:
          print(chunk.choices[0].delta.content, end="", flush=True)
  ```
</CodeGroup>

## AI Gateway Features

<CardGroup cols={2}>
  <Card title="Reasoning models" icon="brain" href="/docs/ai-studio/ai-gateway/reasoning" horizontal>
    Configure `thinking_level` for Gemini 3 preview models and `budget_tokens` for Gemini 2.5 through the **AI Gateway**.
  </Card>

  <Card title="Web Search" icon="magnifying-glass" href="/docs/ai-studio/ai-gateway/web-search" horizontal>
    Enable Google Search grounding for supported Gemini models via the Responses API.
  </Card>
</CardGroup>

## Reference

* [Google Gemini Documentation](https://ai.google.dev/docs)
* [Model Pricing](https://ai.google.dev/pricing)
* [API Reference](https://ai.google.dev/api)
