Skip to content
Esc
↑↓navigate↵open⌘Jpreview
Start
On this page

LLMGateway

Enterprise-grade AI gateway with unified API access to multiple providers. Smart routing, caching, and observability for production LLM applications.

What is the Autohand LLMGateway integration?

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.

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

Setup

Get started with LLMGateway.

Get your API key

  1. Go to 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

# 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:

# 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:

{
  "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:

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

Available 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

Troubleshooting

Common issues

Issue Solution
Invalid API key Verify key at llmgateway.io
Upstream error Check provider configuration in dashboard
Rate limited Check rate limit settings

Debug mode

# 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.

Last updated on

Was this helpful?

Send Feedback

Help us improve this documentation page. Your feedback is valuable.

We'll only contact you if we need clarification