---
title: "LLMGateway"
description: "Enterprise-grade AI gateway with unified API access to multiple providers. Smart routing, caching, and observability for production LLM applications."
seo:
  title: "LLMGateway Integration"
  description: "Access multiple AI providers through LLMGateway.io unified API. Enterprise-grade routing, caching, and observability for LLM applications."
---

## What is the Autohand LLMGateway integration? [#quick-answer]

The Autohand LLMGateway integration sends coding-agent requests through an LLMGateway account instead of connecting to each upstream model provider separately. Autohand uses the gateway endpoint, API key, and selected model route.

|  |  |
| --- | --- |
| Status | Available |
| Requires | An LLMGateway API key and an upstream model route enabled for that account. |
| Configure with | Set `llmgateway.apiKey` (with `autohand config set` or `/model`), select the `llmgateway` provider, and configure the model or route exposed by the gateway. |
| Best for | Centralized routing, policy, caching, and observability across model providers, managed in the LLMGateway dashboard. |

:::warning
**Know before you start:** Model behavior, availability, cost, and latency depend on both the gateway configuration and the upstream provider.
:::

## Overview

LLMGateway.io provides a unified interface to multiple AI providers with enterprise features. When integrated with Autohand, you get:

- Access to OpenAI, Anthropic, Google, and more through one API
- Intelligent request routing and load balancing
- Response caching for cost optimization
- Automatic failover between providers
- Detailed analytics and observability
- Rate limiting and budget controls

:::tip
**Enterprise ready:** LLMGateway is designed for teams that need centralized control over AI usage, cost management, and compliance features.
:::

## Setup

Get started with LLMGateway.

### Get your API key

1. Go to [llmgateway.io](https://llmgateway.io) and create an account
2. Configure your upstream providers (OpenAI, Anthropic, etc.)
3. Navigate to **API Keys** and create a key

### Configure Autohand

```bash
# Configure via CLI
autohand config set llmgateway.apiKey "lgw-xxxxxxxxxxxxxxxxxxxx"

# Or interactively: pick LLMGateway in the model picker
/model
```

Autohand does not read `LLMGATEWAY_API_KEY` from the environment; the key is stored as `llmgateway.apiKey` in `~/.autohand/config.json`.

Verify your configuration:

```bash
# Start with LLMGateway provider
autohand --provider llmgateway --model gpt-4o

# Test with a prompt
autohand --prompt "Hello, which model are you?"
```

## CLI configuration

Configure LLMGateway in your `~/.autohand/config.json`:

```json
{
  "provider": "llmgateway",
  "llmgateway": {
    "apiKey": "lgw-xxxxxxxxxxxxxxxxxxxx",
    "baseUrl": "https://api.llmgateway.io/v1",
    "model": "gpt-4o"
  }
}
```

### Configuration options

| Option | Description | Default |
| --- | --- | --- |
| `apiKey` | Your LLMGateway API key | \- |
| `baseUrl` | Gateway endpoint | `https://api.llmgateway.io/v1` |
| `model` | Default model to use | `gpt-4o` |
| `contextWindow` | Override the model's context window (tokens) | From model metadata |
| `reasoningEffort` | Reasoning effort for reasoning-capable models: `none`, `low`, `medium`, `high`, `xhigh` | \- |

## Features

### Routing, caching, and failover

Routing strategy, response caching, and provider failover are configured on the LLMGateway side (in your LLMGateway dashboard), not in Autohand. Autohand has no `routing`, `caching`, `cacheTTL`, or `fallbackModels` keys; it sends OpenAI-compatible `/chat/completions` requests to `baseUrl` with the configured `model`.

### Retries and timeouts

Autohand retries failed requests to the gateway using the global `network` settings:

```json
{
  "network": {
    "maxRetries": 3,
    "retryDelay": 1000,
    "timeout": 30000
  }
}
```

## Available models [#models]

Access any model from your configured upstream providers. Common options include:

| Provider | Models |
| --- | --- |
| OpenAI | gpt-4o, gpt-4-turbo, o1 |
| Anthropic | claude-3-5-sonnet-20241022, claude-3-5-haiku-20241022 |
| Google | gemini-1.5-pro, gemini-1.5-flash |
| Meta | llama-3.1-70b, llama-3.1-405b |

## Best practices

- **Configure fallbacks**: Set up fallback routes in the LLMGateway dashboard for reliability.
- **Enable caching**: Turn on gateway-side caching in LLMGateway to reduce costs for repeated queries.
- **Set budgets**: Configure spending limits in the LLMGateway dashboard.
- **Monitor usage**: Use the analytics dashboard to track costs and usage.

## Resources

- [LLMGateway Website](https://llmgateway.io)
- [Documentation](https://docs.llmgateway.io)
- [Dashboard](https://app.llmgateway.io)
- [API Reference](https://docs.llmgateway.io/api-reference)
- [Pricing](https://llmgateway.io/pricing)

## Troubleshooting

### Common issues

| Issue | Solution |
| --- | --- |
| Invalid API key | Verify key at [llmgateway.io](https://app.llmgateway.io) |
| Upstream error | Check provider configuration in dashboard |
| Rate limited | Check rate limit settings |

### Debug mode

```bash
# Enable verbose logging
AUTOHAND_DEBUG=true autohand --provider llmgateway
```

**How do I configure the Autohand LLMGateway integration?**

Set `llmgateway.apiKey` (with `autohand config set` or `/model`), select the `llmgateway` provider, and configure the model or route exposed by the gateway.

**What does the Autohand LLMGateway integration require?**

An LLMGateway API key and an upstream model route enabled for that account.

**What limitations should I know about?**

Model behavior, availability, cost, and latency depend on both the gateway configuration and the upstream provider.
