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

# Gemini 3.1 Pro Preview Custom Tools

> Gemini 3.1 Pro Preview Custom Tools: fast, efficient language model. Request examples and parameters for MixRoute.

Gemini 3.1 Pro Preview Custom Tools is a fast, efficient language model from Google.

Call `gemini-3.1-pro-preview-customtools` through MixRoute's native Gemini endpoint; an OpenAI-compatible endpoint is also supported.

## Key capabilities

* Native Gemini API - Uses generateContent with content parts
* System instructions - Supports systemInstruction
* Generation control - Uses generationConfig
* OpenAI-compatible - Also works through Chat Completions

## Quick example

### Gemini native API

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/models/gemini-3.1-pro-preview-customtools:generateContent" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "contents": [
        {
          "role": "user",
          "parts": [
            {
              "text": "Explain quantum entanglement in simple terms."
            }
          ]
        }
      ],
      "generationConfig": {
        "temperature": 1,
        "topP": 1
      }
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import requests

    response = requests.post(
        "https://api.mixroute.ai/v1/models/gemini-3.1-pro-preview-customtools:generateContent",
        headers={"Authorization": "Bearer YOUR_API_KEY"},
        json={'contents': [{'role': 'user',
                            'parts': [{'text': 'Explain quantum entanglement in simple terms.'}]}],
              'generationConfig': {'temperature': 1, 'topP': 1}},
    )

    print(response.json())
    ```
  </Tab>
</Tabs>

### OpenAI-compatible API

<Tabs>
  <Tab title="cURL">
    ```bash theme={null}
    curl "https://api.mixroute.ai/v1/chat/completions" \
      -H "Authorization: Bearer YOUR_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "gemini-3.1-pro-preview-customtools",
      "messages": [
        {
          "role": "user",
          "content": "Explain quantum entanglement in simple terms."
        }
      ],
      "max_tokens": 256
    }'
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    response = client.chat.completions.create(
        model="gemini-3.1-pro-preview-customtools",
        messages=[{"role": "user", "content": "Explain quantum entanglement in simple terms."}],
        max_tokens=256,
    )

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

  <Tab title="Streaming">
    ```python theme={null}
    from openai import OpenAI

    client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.mixroute.ai/v1")

    stream = client.chat.completions.create(
        model="gemini-3.1-pro-preview-customtools",
        messages=[{"role": "user", "content": "Write a short poem about the sea."}],
        max_tokens=256,
        stream=True,
    )

    for chunk in stream:
        print(chunk.choices[0].delta.content or "", end="")
    ```
  </Tab>
</Tabs>

## Parameters

### Gemini native API

| Parameter           | Type   | Required | Description                                       |
| ------------------- | ------ | -------- | ------------------------------------------------- |
| `contents`          | array  | Yes      | Conversation content built from role and parts.   |
| `systemInstruction` | object | No       | System instruction with content parts.            |
| `generationConfig`  | object | No       | Generation settings such as temperature and topP. |
| `safetySettings`    | array  | No       | Content-safety settings.                          |

### OpenAI-compatible API

| Parameter     | Type            | Required | Description                                       |
| ------------- | --------------- | -------- | ------------------------------------------------- |
| `model`       | string          | Yes      | Must be `gemini-3.1-pro-preview-customtools`.     |
| `messages`    | array           | Yes      | Conversation messages with role and content.      |
| `max_tokens`  | integer         | No       | Maximum generated tokens.                         |
| `stream`      | boolean         | No       | Enable SSE streaming. Default: false.             |
| `temperature` | number          | No       | Sampling temperature when supported by the model. |
| `top_p`       | number          | No       | Nucleus sampling threshold when supported.        |
| `stop`        | string \| array | No       | Sequences that stop generation.                   |
| `tools`       | array           | No       | OpenAI-compatible tool definitions.               |
