Unified API for multiple LLM providers.
## OpenRouter MCP Server: Unified LLM API Gateway The **OpenRouter MCP Server** connects Google Antigravity to OpenRouter's unified API for 100+ language models. This gateway provides a single interface to access models from OpenAI, Anthropic, Google, Meta, and many more providers. ### Why OpenRouter MCP? OpenRouter simplifies multi-model access: - **100+ Models**: One API for all major LLMs - **Automatic Fallbacks**: Route to alternatives on failure - **Cost Optimization**: Compare pricing across providers - **Usage Tracking**: Unified billing and analytics - **Antigravity Native**: Seamless model switching ### Key Features #### 1. Universal Chat API ```python import openai client = openai.OpenAI( base_url="https://openrouter.ai/api/v1", api_key="your-openrouter-key" ) # Use any model with the same API response = client.chat.completions.create( model="anthropic/claude-3.5-sonnet", messages=[{"role": "user", "content": "Hello!"}] ) # Switch models easily response = client.chat.completions.create( model="google/gemini-pro", messages=[{"role": "user", "content": "Hello!"}] ) ``` #### 2. Model Selection ```python # Available models include: models = [ "openai/gpt-4-turbo", "anthropic/claude-3-opus", "google/gemini-1.5-pro", "meta-llama/llama-3.1-405b", "mistralai/mixtral-8x22b", "cohere/command-r-plus" ] # Compare responses across models for model in models: response = client.chat.completions.create( model=model, messages=[{"role": "user", "content": question}] ) print(f"{model}: {response.choices[0].message.content}") ``` #### 3. Fallback Routing ```python # Configure fallbacks for reliability response = client.chat.completions.create( model="openai/gpt-4", messages=[{"role": "user", "content": prompt}], extra_body={ "route": "fallback", "models": ["anthropic/claude-3-opus", "google/gemini-pro"] } ) ``` ### Configuration ```json { "mcpServers": { "openrouter": { "command": "npx", "args": ["-y", "@anthropic/mcp-openrouter"], "env": { "OPENROUTER_API_KEY": "your-api-key" } } } } ``` ### Use Cases **Model Comparison**: Test prompts across multiple models to find the best fit for your use case. **Reliability**: Automatic fallback to alternative models prevents downtime. **Cost Management**: Route requests to cheaper models when premium quality isn't needed. The OpenRouter MCP Server provides unified LLM access for Antigravity development.
{
"mcpServers": {
"openrouter": {}
}
}