About gammainfra
gammainfra is an MCP server for agents that need to call models through GammaInfra’s OpenAI-shaped API. It offers model routing controls and returns routing, cost, and fallback details alongside responses.
Key features
- 01Call models with configurable routing
- 02Browse model pricing and capabilities
- 03Check managed and BYOK balances
- 04View provider health and request metrics
Use cases
- 01Route requests by cost, quality, or latency
- 02Inspect model options before choosing
- 03Check account balances and provider status
MCP support
Exposes four tools to MCP clients: chat_completions, list_models, get_balance, and get_status. chat_completions returns the model response with structured routing metadata.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
npx -y @gammainfra/mcp-serverGAMMAINFRA_API_KEYSecretGammaInfra API key (sk-gammainfra-...). Free key at https://gammainfra.com/signupGAMMAINFRA_BASE_URLOptional base URL override. Defaults to https://api.gammainfra.com/v1Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.
Tools
4Saved tool list · updated 3w ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model name. Use 'gammainfra/auto' to let the router pick, 'gammainfra/fast' for latency, 'gammainfra/cheap' for cost, or pin a specific provider/model like 'openai/gpt-5-mini' or 'anthropic/claude-opus-4-7'. |
| tools | array | No | |
| top_p | number | No | |
| region | string | No | Constrain endpoint region: 'us', 'eu', 'apac', or specific AWS region like 'us-east-1'. Sent as X-GammaInfra-Region header. |
| messages | array | Yes | Conversation messages in OpenAI shape. |
| max_tokens | integer | No | |
| preference | enum | No | Coarse routing preference. Sent as X-GammaInfra-Preference header.quality | cost | latency |
| temperature | number | No | |
| tool_choice | any | No | |
| cost_quality | number | No | Continuous cost-vs-quality dial. 0.0 = pure quality, 1.0 = pure cost. Sent as X-GammaInfra-Cost-Quality header. |
| max_latency_ms | integer | No | Cap total wall-clock time (including fallback retries) in ms. Sent as X-GammaInfra-Max-Latency-Ms header. |
| response_format | any | No | |
| presence_penalty | number | No | |
| frequency_penalty | number | No | |
| max_completion_tokens | integer | No |
Details
From the project README@gammainfra/mcp-server
Model Context Protocol (MCP) server for GammaInfra — intelligent LLM routing across every major provider via one OpenAI-shape API.
Drop this server into Claude Code, Claude Desktop, Cursor, Cline, Continue, or any MCP-compatible host, and your agent gets direct tool access to:
chat_completions— call any supported model (orgammainfra/autofor smart routing) with cost, latency, and quality controls. Routing metadata (which provider served, exact cost in USD, fallback chain) is returned as a structuredrouting_metafield.list_models— full model catalog with pricing and capability flags.get_balance— managed + BYOK balances.get_status— overall + per-provider health, 24h request count.
Quickstart
- Get a GammaInfra API key — sign up free at https://gammainfra.com/signup ($3 trial credit, no credit card).
- Add the server to your MCP client config (instructions per client below).
- Restart the client. The four tools become available to your agent immediately.
Installation
The server runs via npx — no manual install needed. The first invocation downloads and caches the package.
Claude Code
claude mcp add gammainfra \
--env GAMMAINFRA_API_KEY=sk-gammainfra-... \
-- npx -y @gammainfra/mcp-server
Or edit ~/.claude.json and add to the mcpServers block:
{
"mcpServers": {
"gammainfra": {
"command": "npx",
"args": ["-y", "@gammainfra/mcp-server"],
"env": { "GAMMAINFRA_API_KEY": "sk-gammainfra-..." }
}
}
}
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"gammainfra": {
"command": "npx",
"args": ["-y", "@gammainfra/mcp-server"],
"env": { "GAMMAINFRA_API_KEY": "sk-gammainfra-..." }
}
}
}
Restart Claude Desktop. The "GammaInfra" server should appear in the tools menu.
Cursor
Edit ~/.cursor/mcp.json:
{
"mcpServers": {
"gammainfra": {
"command": "npx",
"args": ["-y", "@gammainfra/mcp-server"],
"env": { "GAMMAINFRA_API_KEY": "sk-gammainfra-..." }
}
}
}
Cline (VS Code)
Open Cline's settings (gear icon → MCP Servers tab) and add:
{
"gammainfra": {
"command": "npx",
"args": ["-y", "@gammainfra/mcp-server"],
"env": { "GAMMAINFRA_API_KEY": "sk-gammainfra-..." },
"disabled": false
}
}
Environment variables
| Var | Required | Default | Description |
|---|---|---|---|
GAMMAINFRA_API_KEY | yes | — | Your GammaInfra API key, format sk-gammainfra-{32_chars}. |
GAMMAINFRA_BASE_URL | no | https://api.gammainfra.com/v1 | Override for staging/dev. |
Tool reference
chat_completions
Send a chat completion request and receive the model response plus routing metadata.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
model | string | yes | gammainfra/auto for smart routing, gammainfra/fast/gammainfra/cheap for tier shortcuts, or pin a specific model like openai/gpt-5-mini. |
messages | array | yes | OpenAI-shape conversation messages. |
temperature | number | no | 0..2. |
max_tokens | int | no | |
max_completion_tokens | int | no | GPT-5 family requires this instead of max_tokens. |
cost_quality | float | no | 0.0..1.0 continuous dial. Sent as X-GammaInfra-Cost-Quality. |
max_latency_ms | int | no | 60..600000. Caps total wall-clock incl. fallback retries. Also enforced client-side as a hard request abort. |
preference | string | no | quality, cost, or latency. |
region | string | no | us, eu, apac, or specific AWS region. |
tools, tool_choice, response_format, top_p, frequency_penalty, presence_penalty | various | no | Standard OpenAI fields, forwarded as-is. |
Returns: { response: <OpenAI response>, routing_meta: { provider, endpoint, cost_usd, input_cost_usd, output_cost_usd, router_version, logical_model, fallback_chain, attempted_count, request_id, ... } }
Timeout note: Every request has a 10-minute client-side hard timeout (via AbortController) so a hung upstream can't wedge the MCP process. For chat_completions, a supplied max_latency_ms replaces that default as the hard abort bound.
Streaming note: MCP tool responses are non-streaming. The server always sends stream: false to the upstream and does not accept a stream parameter on the tool input (it's rejected by schema validation). For streaming, use the GammaInfra HTTP API directly.
list_models
No parameters. Returns the full model catalog including direct-pin slugs, per-token pricing, and capability flags (supports_tools, supports_vision).
get_balance
| Name | Type | Required | Description |
|---|---|---|---|
include_byok | boolean | no | Default false. Also fetch the BYOK balance. Off by default to avoid an extra request — and a guaranteed 404 — for customers without BYOK enrollment. |
Returns { managed_balance_usd, byok_balance_usd, currency }. With include_byok omitted/false, byok_balance_usd is null and no BYOK request is made (no byok_error). With include_byok: true, if BYOK isn't enrolled, byok_balance_usd is null and a byok_error field describes the cause.
get_status
No parameters. Returns GammaInfra's current overall health, per-provider state and live p50 latency, and 24h request count.
Development
git clone https://github.com/yuz0101/gammainfra-mcp-server.git
cd gammainfra-mcp-server
npm install
npm run test # 30 tests, ~1s
npm run build # tsc → dist/
npm run typecheck
License
MIT — see LICENSE.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.