> For the complete documentation index, see [llms.txt](https://anyint.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://anyint.gitbook.io/docs/api-reference/gemini-compatible.md).

# gemini compatible

The current API catalog publishes several Gemini-style routes. Use the exact path shown below instead of assuming that every Gemini request shares one prefix. This is the main difference between AnyInt's current Gemini surface and a single OpenAI-style chat route.

## Published routes

| Route                                                                     | Use case                                         |
| ------------------------------------------------------------------------- | ------------------------------------------------ |
| `POST /gemini/v1beta/models/gemini-2.5-pro:generateContent`               | Text generation                                  |
| `POST /gemini/v1beta/models/gemini-2.5-pro:streamGenerateContent?alt=sse` | Streaming generation                             |
| `POST /gemini/v1beta/models/gemini-2.5-flash-image:generateContent`       | Text-plus-image output                           |
| `POST /v1beta/models/gemini-2.0-flash:generateContent`                    | Tool or function calling                         |
| `POST /v1beta/models/gemini-2.5-flash-preview-04-17:generateContent`      | Thinking-budget variant published in the catalog |

## Authentication

```http
Authorization: Bearer <ANYINT_API_KEY>
```

## When to use Gemini-compatible routes

* You want to keep Gemini-native `contents[].parts[]` payloads
* You need `streamGenerateContent?alt=sse`
* You want Gemini-native `tools.functionDeclarations`
* You want the published Gemini image-generation route instead of a generic chat wrapper

If you want one uniform SDK integration, start with the [OpenAI Compatible API](broken://pages/6ee5d3b6bc67437668e2474dbbe94f7f57ce3912) instead.

## Text generation example

```bash
curl https://gateway.api.anyint.ai/gemini/v1beta/models/gemini-2.5-pro:generateContent \
  -H "Authorization: Bearer $ANYINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [
          {"text": "How does AnyInt help multi-provider teams?"}
        ]
      }
    ]
  }'
```

The minimum published request body is:

* `contents`
* `contents[].parts`
* `parts[].text`

## Streaming example

```bash
curl "https://gateway.api.anyint.ai/gemini/v1beta/models/gemini-2.5-pro:streamGenerateContent?alt=sse" \
  -H "Authorization: Bearer $ANYINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [
          {"text": "Stream a short answer about API gateways."}
        ]
      }
    ]
  }'
```

The `alt=sse` query parameter is required on the published streaming route.

## Function-calling example

```bash
curl https://gateway.api.anyint.ai/v1beta/models/gemini-2.0-flash:generateContent \
  -H "Authorization: Bearer $ANYINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "role": "user",
        "parts": [
          {"text": "What is the temperature in London?"}
        ]
      }
    ],
    "tools": [
      {
        "functionDeclarations": [
          {
            "name": "get_current_temperature",
            "description": "Gets the current temperature for a given location.",
            "parameters": {
              "type": "object",
              "properties": {
                "location": {
                  "type": "string",
                  "description": "The city name, e.g. San Francisco"
                }
              },
              "required": ["location"]
            }
          }
        ]
      }
    ]
  }'
```

This is the published Gemini-native tool pattern. It is the right choice when you want the model to emit function arguments using `functionDeclarations` rather than OpenAI-style `tools`.

## Image generation example

The published image-generation schema requires `generationConfig.responseModalities` to include both `TEXT` and `IMAGE`.

```bash
curl https://gateway.api.anyint.ai/gemini/v1beta/models/gemini-2.5-flash-image:generateContent \
  -H "Authorization: Bearer $ANYINT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {
        "parts": [
          {"text": "Generate a cinematic poster for an AI music launch."}
        ]
      }
    ],
    "generationConfig": {
      "responseModalities": ["TEXT", "IMAGE"]
    }
  }'
```

## Thinking-budget route

The catalog also publishes:

`POST https://gateway.api.anyint.ai/v1beta/models/gemini-2.5-flash-preview-04-17:generateContent`

This route is described as a thinking-budget variant. The current published request-body example is irregular because it is stored under `text/plain` even though the example content is JSON-like. Treat this route as an advanced preview path and validate it in your environment before depending on it in production.

## Common mistakes

* Forgetting `alt=sse` on the streaming route
* Assuming every Gemini route starts with `/gemini/v1beta`
* Omitting `responseModalities` on image generation
* Sending OpenAI `messages` instead of Gemini `contents[].parts[]`

## Related pages

* [Media APIs](/docs/api-reference/media-apis.md)
* [Tool Calling](/docs/features/tool-calling.md)
* [Streaming](/docs/features/streaming.md)
* [Image Generation](/docs/models-and-modalities/image-generation.md)
