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

# Antigravity

> Connect the Antigravity App, standalone IDE, and CLI to TrueFoundry AI Gateway with a shared configuration, then select and test your Gemini model.

Route Antigravity's model requests through TrueFoundry AI Gateway using its OpenAI-compatible endpoint. This guide uses `tfy-ai-vertex/google-gemini-4-carbon`, a Gemini model configured in a TrueFoundry Vertex AI model account.

The **Antigravity App** is the desktop agent workspace. **Antigravity IDE** is the separate code editor. Both clients and the **`agy` CLI** can use the same gateway configuration.

## Prerequisites

* A TrueFoundry API key with access to your model. See [Authentication](https://www.truefoundry.com/docs/ai-gateway/authentication.md).
* A Gemini model configured in a [Vertex AI model account](https://www.truefoundry.com/docs/ai-gateway/google-vertex.md).
* The [Antigravity App, IDE, or CLI](https://antigravity.google/download) installed. Choose the client you want to use; you do not need all three.

## Configure the gateway

**1. Get your gateway details**

Open the **AI Gateway Playground** in TrueFoundry and copy the gateway base URL and model ID from the code snippet. See [Find your gateway base URL](https://www.truefoundry.com/docs/ai-gateway/quick-start.md#gateway-base-url).

![TrueFoundry Playground code snippet showing the gateway base URL and model ID](https://mintcdn.com/truefoundry/n3EuZuJ0K8wBFp1G/images/new-code-snippet.png?fit=max\&auto=format\&n=n3EuZuJ0K8wBFp1G\&q=85\&s=3634c2dc8c3565fd77ab896d3fd07ed9)

Copy the gateway base URL and model ID from the Playground code snippet.

You will use these values in the configuration:

| Value | What to enter |
| - | - |
| Gateway URL | Your gateway base URL, such as `https://your-company.truefoundry.cloud/api/llm`. Do not append `/v1` or `/chat/completions`. |
| API key | Your **TrueFoundry API key**, rather than a Google or Vertex AI key. |
| Model ID | The full ID shown in TrueFoundry, for example `tfy-ai-vertex/google-gemini-4-carbon`. |

**2. Save the shared configuration**

Create the directory if it does not exist:

```bash theme={"dark"}
mkdir -p ~/.gemini/config
```

Open `~/.gemini/config/config.json` in your editor. If the file already exists, add the `gateway` and `models` sections below while keeping your other settings.

```json ~/.gemini/config/config.json theme={"dark"}
{
  "gateway": {
    "enabled": true,
    "url": "{GATEWAY_BASE_URL}",
    "apiKey": "YOUR_TRUEFOUNDRY_API_KEY",
    "wireProtocol": "openai"
  },
  "models": {
    "defaultModelId": "tfy-ai-vertex/google-gemini-4-carbon",
    "list": [
      {
        "modelId": "tfy-ai-vertex/google-gemini-4-carbon",
        "displayName": "tfy-ai-vertex/google-gemini-4-carbon"
      }
    ],
    "tiers": {
      "flash": ["tfy-ai-vertex/google-gemini-4-carbon"],
      "flashLite": ["tfy-ai-vertex/google-gemini-4-carbon"],
      "pro": ["tfy-ai-vertex/google-gemini-4-carbon"]
    }
  }
}
```

Replace `{GATEWAY_BASE_URL}` and `YOUR_TRUEFOUNDRY_API_KEY` with your values. If your model ID differs, replace it everywhere in the example.

* **`wireProtocol: "openai"`** sends requests to the gateway's `/v1/chat/completions` endpoint. It also works when the model behind the gateway is Gemini.
* **`models.list`** lists the models available in Antigravity's model picker.
* **`models.tiers`** sends background and subagent model requests to the configured model too. The example uses Carbon for every tier to start with one model.

**3. Restart Antigravity**

Quit and reopen the App or IDE, or start a new CLI session. You can open the desktop clients normally from Finder or the Dock; no terminal launch or Google sign-in is needed for this gateway setup.

> [!NOTE]
>
> Existing `AGY_LLM_GATEWAY_*` environment variables can override the user configuration. Update or remove old exports if Antigravity still uses a previous URL, key, or model. On a managed workstation, administrator policy can also take precedence.

## Select a model and test the connection

> [tab] Desktop App
>
> Open a new conversation in **Antigravity**. Click the model selector below the message box and choose `tfy-ai-vertex/google-gemini-4-carbon`.
>
> ![Antigravity App model picker listing tfy-ai-vertex/google-gemini-4-carbon](https://mintcdn.com/truefoundry/5xW_S_lSL9e281Ek/images/ai-gateway/antigravity/model-picker.png?fit=max\&auto=format\&n=5xW_S_lSL9e281Ek\&q=85\&s=5da7ecb4b8942c38aee113218e297a60)
>
> Select your TrueFoundry model in the Antigravity App.
>
> Send this prompt:
>
> ```text theme={"dark"}
> Show a Python function that removes duplicates from a list while preserving order, with a short example.
> ```
>
> You should receive a Python function and a short usage example.
>
> ![Antigravity desktop App showing a Python function for removing duplicate list items with Gemini Carbon selected](https://mintcdn.com/truefoundry/5xW_S_lSL9e281Ek/images/ai-gateway/antigravity/desktop-app.png?fit=max\&auto=format\&n=5xW_S_lSL9e281Ek\&q=85\&s=24f65a9c3a4f184fa9c770c54cd8cd91)
>
> A successful response using Gemini Carbon through TrueFoundry.

> [tab] Standalone IDE
>
> Open **Antigravity IDE** and start a new conversation in the **Agent** panel. Select `tfy-ai-vertex/google-gemini-4-carbon` below the message box, then send:
>
> ```text theme={"dark"}
> Show a Python function that removes duplicates from a list while preserving order, with a short example.
> ```
>
> You should receive a Python function and a short usage example.
>
> ![Standalone Antigravity IDE Agent panel showing a Python coding example through TrueFoundry AI Gateway](https://mintcdn.com/truefoundry/5xW_S_lSL9e281Ek/images/ai-gateway/antigravity/standalone-ide.png?fit=max\&auto=format\&n=5xW_S_lSL9e281Ek\&q=85\&s=6f87fe86342aa34dc9422db41c3ee768)
>
> The standalone Antigravity IDE using the shared gateway configuration.

> [tab] CLI
>
> Check that Antigravity lists the configured model:
>
> ```bash theme={"dark"}
> agy models
> ```
>
> The output should include `tfy-ai-vertex/google-gemini-4-carbon`. Then run:
>
> ```bash theme={"dark"}
> agy --model tfy-ai-vertex/google-gemini-4-carbon \
>   -p "Show a Python function that removes duplicates from a list while preserving order, with a short example."
> ```
>
> You should receive a Python function and a short usage example. The exact response can vary.
>
> Run `agy` without `-p` to start an interactive session.

Open **Request Traces** in TrueFoundry AI Gateway and find the request for `tfy-ai-vertex/google-gemini-4-carbon`. Confirm that it completed successfully to verify that the request went through your gateway.

## Add more models

Register the model in TrueFoundry, then add its full model ID to `models.list` and restart Antigravity. You can keep the same gateway URL and API key, provided the key has access to the new model. For coding workflows, verify streaming and multi-turn tool calling with each model before rolling it out.

## Troubleshooting

| Issue | What to check |
| - | - |
| Antigravity asks you to sign in | Confirm that `gateway.enabled` is `true` in `~/.gemini/config/config.json`, then fully quit and reopen the client. |
| Wrong model or gateway | Check for old `AGY_LLM_GATEWAY_*` exports or administrator settings overriding the file. |
| `401` or `403` | Check the TrueFoundry API key and its access to the configured model. |
| Model not found | Copy the complete model ID from TrueFoundry, including the model-account prefix. |
| `429` | Check the error message for a rate limit or exceeded [budget](https://www.truefoundry.com/docs/ai-gateway/budget-limiting-v2.md). |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.