Agent Gateway for Openclaw

A smart multi-model routing proxy for Openclaw Skills that enables seamless switching between major LLM providers with built-in cost optimization and fallbacks.

mackding
v1.0.0
Apr 1, 2026
0
688
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install agent-gateway

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install agent-gateway using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Agent Gateway?

Agent Gateway serves as a sophisticated intermediary for your AI agents, allowing you to manage and optimize interactions across various Large Language Models. By acting as a local proxy, it enables developers using Openclaw Skills to unify their API interactions through a single, OpenAI-compatible endpoint. This skill provides the flexibility to switch between high-performance models like Claude and GPT-4 or cost-effective local options like Ollama based on specific project needs or budget constraints.

This utility is essential for building resilient AI applications that require high availability. It abstracts the complexity of multiple provider SDKs into a standardized workflow, ensuring your agents remain functional even if a specific provider experiences downtime or rate limiting.

Agent Gateway Use Cases

  • Dynamically routing requests to the most cost-effective model for routine tasks while reserving high-tier models for complex reasoning.
  • Implementing automatic fallback chains to maintain uptime when a primary LLM provider is unavailable.
  • Monitoring and aggregating real-time cost data across multiple providers to manage API spending.
  • Testing local Ollama models alongside cloud-based providers without changing application logic.

How Agent Gateway Works

  1. The user initiates the gateway server locally via CLI or script, specifying the desired port.
  2. API keys for providers like Anthropic, OpenAI, or Google are loaded through environment variables.
  3. The gateway receives requests via an OpenAI-compatible /v1/chat/completions endpoint.
  4. Based on the selected routing strategy (cheapest, best-quality, or balanced), the gateway selects the optimal provider.
  5. If the primary provider fails, the system automatically triggers a fallback chain to an alternative model.
  6. Usage and cost metrics are calculated and stored locally for tracking and reporting.

Agent Gateway Setup

To begin using this skill within the Openclaw Skills ecosystem, start the server using the CLI:

npx @claws-shield/cli gateway --port 8787

Ensure your environment variables are configured with the necessary API keys:

export ANTHROPIC_API_KEY="your_key"
export OPENAI_API_KEY="your_key"
export GEMINI_API_KEY="your_key"

You can then point your OpenAI-compatible clients to http://localhost:8787/v1/chat/completions.

Agent Gateway Data Schema & Taxonomy

The Agent Gateway manages configuration and tracking data locally using a structured approach:

Data Type Description
Provider Config Environment variables mapping to Anthropic, OpenAI, and Gemini keys.
Cost Logs Per-request metadata including token counts and provider-specific pricing.
Aggregation Local summaries of daily, weekly, and monthly spending.
Health Status Real-time monitoring data for the circuit breaker and health check patterns.

Agent Gateway Advanced Features

  • Support for local Ollama instances to eliminate external API costs for development and testing.
  • Implementation of the circuit breaker pattern to prevent cascading failures during provider outages.
  • Customizable routing strategies (cheapest, best-quality, balanced) to align with specific business goals.
  • Local-first privacy model ensuring that sensitive usage data and API keys are never transmitted to third parties.
  • Drop-in OpenAI compatibility for seamless integration with existing AI development frameworks in Openclaw Skills.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*