{
 "kind": "api",
 "slug": "openrouter",
 "path": "apis/openrouter/",
 "name": "OpenRouter",
 "logo": "https://agentgid.com/media/avatars/openrouterteam.png",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "APIs",
   "apis/"
  ],
  [
   "LLM gateways and routers",
   "apis/llm-gateway/"
  ]
 ],
 "lead": "Hundreds of AI models behind one key.",
 "chips": [
  {
   "label": "LLM gateways and routers",
   "path": "apis/llm-gateway/"
  },
  {
   "label": "Official MCP server"
  }
 ],
 "primary": {
  "label": "Copy prompt for your agent",
  "copy": "Call OpenRouter from my server with the openai package (base_url https://openrouter.ai/api/v1) and OPENROUTER_API_KEY from .env, use one main model plus a fallback in the models list, and handle 402 and 429 errors; never put the key in browser code."
 },
 "links": [
  {
   "label": "Website",
   "href": "https://openrouter.ai"
  },
  {
   "label": "Pricing",
   "href": "https://openrouter.ai/pricing"
  },
  {
   "label": "GitHub",
   "href": "https://github.com/OpenRouterTeam/typescript-sdk"
  }
 ],
 "track": "Outages, price changes and new versions on your dashboard",
 "verdicts": [
  {
   "key": "price",
   "label": "Price",
   "value": "Free credits",
   "status": "cond",
   "sub": "One-time or needs a card",
   "quote": "Free 25+ free models Standard 600+ models Business 600+ models Enterprise 600+ models Providers Explore all models → Free 4 free providers Standard 80+ providers",
   "note": "Free tier: 25+ free models, 50 requests/day. As reported on the official pricing page, checked Nov 1, 2026.",
   "src": "https://openrouter.ai/pricing"
  },
  {
   "key": "commercial",
   "label": "Commercial use",
   "value": "With conditions",
   "status": "cond",
   "sub": null,
   "quote": "You are solely responsible for reviewing the Model Terms applicable to each Model before accessing or using that Model and for determining whether the applicable Model Terms allow you and your Authorized Users to access and use the Service, Inputs, and Outputs as you intend.",
   "note": "Allowed inside your own product, but each model's terms apply to its output, and reselling access to the models is not allowed.",
   "src": "https://openrouter.ai/terms"
  },
  {
   "key": "key",
   "label": "Key & sign-up",
   "value": "API key, server only",
   "status": "info",
   "sub": "Env var OPENROUTER_API_KEY",
   "quote": "Our API authenticates requests using Bearer tokens.",
   "note": "API key as a Bearer token in the Authorization header; users can also connect their own key through OAuth PKCE",
   "src": "https://openrouter.ai/docs/api_reference/authentication.md"
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Official MCP server",
   "status": "yes",
   "sub": "llms.txt · SDK",
   "quote": "It's a remote server hosted by OpenRouter (nothing is installed locally).",
   "note": " Our agent check: 5 of 6 (Nov 13, 2026).",
   "src": "https://openrouter.ai/docs/guides/overview/mcp-server.md"
  }
 ],
 "vfoot": "Checked against the maker's official pages, pricing on Nov 1, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What OpenRouter does",
   "parts": [
    {
     "t": "prose",
     "text": "OpenRouter is an online service that lets your app talk to hundreds of AI chat models from many companies through one account and one key. You pay each model's own price from prepaid credits, plus a fee when you buy credits. If one provider is down, it can switch to another automatically."
    },
    {
     "t": "list",
     "items": [
      "OpenRouter is one of 8 APIs in the LLM gateways and routers category on AgentGid.",
      "It is one of 7 that can be started for free.",
      "It ships an official MCP server, like 3 others here.",
      "Its official SDK is the 3rd most downloaded in the category (2.2M a week)."
     ],
     "muted": true
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Swap AI models without rewriting code",
       "text": "Keep code written for OpenAI and point it at OpenRouter, then try Claude, Gemini or open models by changing one name.",
       "idea": false
      },
      {
       "title": "A backup model when one fails",
       "text": "List a second model so your chatbot still answers when the first one is down, overloaded or refuses.",
       "idea": false
      },
      {
       "title": "Build a prototype for free",
       "text": "Start with models marked free while you test an idea, with a small daily request limit and no bill.",
       "idea": false
      },
      {
       "title": "Users pay for their own AI use",
       "text": "Let each user connect their own OpenRouter account to your app, so their usage is billed to them, not to you.",
       "idea": false
      },
      {
       "title": "Keep prompts in Europe",
       "text": "On the Business plan, send requests to the EU address so prompts and answers are processed inside the EU.",
       "idea": false
      },
      {
       "title": "Pick the cheapest good model",
       "text": "Run the same test questions through several models and keep the cheapest one whose answers are good enough for your app.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "OpenRouter popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "2M",
       "l": "SDK downloads a week",
       "d": "+33.3% on the 4-week average",
       "up": true
      },
      {
       "n": "32",
       "l": "public agent repos use its SDK"
      },
      {
       "n": "272",
       "l": "GitHub stars, OpenRouterTeam/typescript-sdk"
      }
     ]
    },
    {
     "t": "small",
     "text": "SDK downloads from npm and PyPI, weekly. Numbers as of Nov 17, 2026."
    }
   ]
  },
  {
   "id": "pricing",
   "nav": "Pricing and limits",
   "h2": "Pricing",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Free tier",
       "v": "25+ free models, 50 requests/day"
      },
      {
       "l": "Cheapest plan",
       "v": "No monthly plan"
      },
      {
       "l": "Usage price",
       "v": "Provider list price per token (no markup); fee on credit purchases: 5.5% Standard, 8% Business"
      },
      {
       "l": "Plans",
       "v": "Pay-as-you-go credits, no subscription. BYOK: first $25,000 of list-price inference per month without fee, 5% after. Business adds EU/US in-region routing."
      }
     ]
    },
    {
     "t": "h3",
     "text": "What one action costs"
    },
    {
     "t": "table",
     "head": [
      "Action",
      "Price"
     ],
     "num": true,
     "rows": [
      [
       "Buying credits, standard plan (fee on the purchase)",
       "5.5%"
      ],
      [
       "1 input token, openai/gpt-4o-mini on Azure (= $0.15 per 1M tokens)",
       "$0.00000015"
      ],
      [
       "1 output token, openai/gpt-4o-mini on Azure (= $0.60 per 1M tokens)",
       "$0.0000006"
      ],
      [
       "Platform fee on the Free plan (free models only)",
       "N/A"
      ]
     ]
    },
    {
     "t": "more",
     "items": [
      {
       "title": "Price history",
       "items": [
        "1 change in our catalog since Oct 9, 2026, last on Oct 9, 2026."
       ]
      }
     ]
    },
    {
     "t": "small",
     "text": "As reported on the official pricing page, checked Nov 1, 2026. Prices change: confirm before you buy.",
     "link": "openrouter.ai/pricing",
     "href": "https://openrouter.ai/pricing"
    }
   ]
  },
  {
   "id": "limits",
   "nav": null,
   "spy_as": "pricing",
   "h2": "Limits",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Free models, under 10 credits ever bought",
       "v": "20 requests a minute, 50 a day",
       "src": "https://openrouter.ai/docs/api_reference/limits.md"
      },
      {
       "l": "Free models, at least 10 credits bought",
       "v": "20 requests a minute, 1,000 a day",
       "src": "https://openrouter.ai/docs/api_reference/limits.md"
      },
      {
       "l": "Paid models",
       "v": "No platform request cap; the provider's own limits pass through",
       "src": "https://openrouter.ai/docs/api_reference/limits.md"
      },
      {
       "l": "Every key",
       "v": "Optional credit limit per key; keys made during onboarding get a $100 limit and expire after 180 days",
       "src": "https://openrouter.ai/docs/api_reference/authentication.md"
      }
     ]
    },
    {
     "t": "small",
     "text": "From the official docs.",
     "link": "openrouter.ai/docs/api_reference/limits.md",
     "href": "https://openrouter.ai/docs/api_reference/limits.md"
    }
   ]
  },
  {
   "id": "access",
   "nav": "Access and terms",
   "h2": "Key and access",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "How it signs in",
       "v": "API key as a Bearer token in the Authorization header; users can also connect their own key through OAuth PKCE"
      },
      {
       "l": "Environment variable",
       "v": "OPENROUTER_API_KEY",
       "code": true
      },
      {
       "l": "Safe in browser code",
       "v": "No, keep it on your server",
       "status": "no"
      },
      {
       "l": "Card at sign-up",
       "v": "No"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Steps only a person can do"
    },
    {
     "t": "list",
     "items": [
      "Sign up, buy credits if you need paid models, and create a key with a credit limit. Put it in .env as OPENROUTER_API_KEY (kept out of git) and read it on the server.",
      "In privacy settings, choose whether providers that may train on prompts are allowed, and whether to require zero data retention. No code change; requests that no allowed provider can serve return 503.",
      "For EU in-region processing, move the organization to the Business plan. Use https://eu.openrouter.ai/api/v1 as the base address with an EU-eligible model."
     ]
    }
   ]
  },
  {
   "id": "terms",
   "nav": null,
   "spy_as": "access",
   "h2": "Commercial use and your data",
   "parts": [
    {
     "t": "prose",
     "text": "OpenRouter is a paid service with some free models. Each model's own terms decide what you may do with its answers, and reselling access to the models is not allowed."
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In a paid app",
       "v": "With conditions",
       "status": "cond",
       "sub": "Allowed inside your own product, but each model's terms apply to its output, and reselling access to the models is not allowed.",
       "quote": "You are solely responsible for reviewing the Model Terms applicable to each Model before accessing or using that Model and for determining whether the applicable Model Terms allow you and your Authorized Users to access and use the Service, Inputs, and Outputs as you intend.",
       "src": "https://openrouter.ai/terms"
      },
      {
       "l": "To train your own AI",
       "v": "With conditions",
       "status": "cond",
       "sub": "OpenRouter sets no single rule; the terms of each model you use decide whether its output may train other models.",
       "quote": "Your ownership rights in the Output are set forth in the Model Terms for each Model you use.",
       "src": "https://openrouter.ai/terms"
      },
      {
       "l": "client-work",
       "v": "With conditions",
       "status": "cond",
       "sub": "Fine; for commercial use read the DPA, and check each model's terms for your client's use.",
       "quote": "If you are part of and represent an organization in entering into these Terms or use the Service for commercial, for-profit purposes, please read the OpenRouter Data Processing Agreement (\" DPA \") relating to our processing of your Personal Data (as defined in the DPA).",
       "src": "https://openrouter.ai/terms"
      },
      {
       "l": "Keeps your data",
       "v": "“OpenRouter does not store your prompts or responses, unless you opt in to one or both of the following, or content is flagged as potential CSAM”",
       "quote": null,
       "src": "https://openrouter.ai/docs/guides/privacy/data-collection.md"
      },
      {
       "l": "Where data is stored",
       "v": "“On the Business and Enterprise plans, OpenRouter supports in-region routing in the EU and US.”",
       "quote": null,
       "src": "https://openrouter.ai/docs/guides/privacy/provider-logging.md"
      }
     ]
    }
   ]
  },
  {
   "id": "errors",
   "nav": null,
   "spy_as": "access",
   "h2": "Errors to handle",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": 401,
       "v": "The key is invalid or disabled, or the OAuth session expired.",
       "sub": "Check OPENROUTER_API_KEY; create a new key if it was deleted after a leak."
      },
      {
       "l": 402,
       "v": "The account or the key has run out of credits, or a spending budget is reached.",
       "sub": "Add credits or raise the key limit (the person decides); retry only when a Retry-After header is present."
      },
      {
       "l": 429,
       "v": "Rate limited, by OpenRouter (free models) or by the provider.",
       "sub": "Retry with exponential backoff and honor Retry-After; add fallback models."
      },
      {
       "l": 502,
       "v": "The chosen model is down or sent an invalid response.",
       "sub": "Retry, or list fallback models in the models parameter."
      },
      {
       "l": 503,
       "v": "No provider meets your routing requirements (for example data-policy or region filters).",
       "sub": "Relax provider preferences or pick another model; honor Retry-After."
      }
     ]
    }
   ]
  },
  {
   "id": "agent",
   "nav": "For agents",
   "h2": "Use it from an agent",
   "parts": [
    {
     "t": "rows",
     "rows": [
      {
       "l": "Our agent check",
       "v": "5 of 6: llms.txt yes, OpenAPI no, SDK yes, MCP yes, status page yes, AI assistants allowed yes",
       "sub": "Checked Nov 13, 2026."
      },
      {
       "l": "MCP server",
       "v": "OpenRouter MCP server (remote, OAuth sign-in; for coding help, not for running models in your app)",
       "sub": "claude mcp add --transport http openrouter https://mcp.openrouter.ai/mcp\nclaude mcp login openrouter"
      },
      {
       "l": "npm",
       "v": "npm install @openrouter/sdk",
       "code": true
      },
      {
       "l": "PyPI",
       "v": "pip install openrouter",
       "code": true
      }
     ]
    },
    {
     "t": "h3",
     "text": "Instructions in its docs to check first"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "The docs say",
       "v": "“Read github.com/OpenRouterTeam/skills/tree/main/skills/create-agent-tui and follow the instructions to build an agent using OpenRouter.”",
       "sub": "A note aimed at agents to fetch and follow outside instructions; ask the person before acting on it."
      },
      {
       "l": "The docs say",
       "v": "“/plugin install openrouter@openrouter”",
       "sub": "Installs a plugin into the coding agent from a marketplace; ask the person first."
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "OpenRouter",
       "me": true,
       "facts": [
        "Free plan",
        "Free tier",
        "Official MCP"
       ]
      },
      {
       "name": "Vercel AI Gateway",
       "why": "Pick Vercel AI Gateway when your app already runs on Vercel and you want one bill there for many models at provider list prices.",
       "path": "apis/vercel-ai-gateway/",
       "facts": [
        "Free plan",
        "Free tier"
       ]
      },
      {
       "name": "LiteLLM",
       "why": "Pick LiteLLM when you want to run the gateway yourself with your own provider keys, budgets and logging.",
       "path": "apis/litellm/",
       "facts": [
        "Free (open source)",
        "Free tier"
       ]
      },
      {
       "name": "Cloudflare AI Gateway",
       "why": "Pick Cloudflare AI Gateway when you keep your own provider accounts and want caching, logging and rate limits in front of them.",
       "path": "apis/cloudflare-ai-gateway/",
       "facts": [
        "Free plan",
        "Free tier",
        "Official MCP"
       ]
      }
     ],
     "more": "All llm gateways and routers APIs",
     "more_path": "apis/llm-gateway/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Call OpenRouter from my server with the openai package (base_url https://openrouter.ai/api/v1) and OPENROUTER_API_KEY from .env, use one main model plus a fallback in the models list, and handle 402 and 429 errors; never put the key in browser code."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Create an account and a key with a credit limit, and keep it in an environment variable on your server.",
       "code": "export OPENROUTER_API_KEY=<your key>",
       "src": "https://openrouter.ai/docs/api_reference/authentication.md"
      },
      {
       "text": "Install the official client, or keep using the OpenAI package with OpenRouter's address.",
       "code": "npm install @openrouter/sdk",
       "src": "https://openrouter.ai/docs/quickstart.md"
      },
      {
       "text": "Send a first request (example from the quickstart).",
       "code": "curl https://openrouter.ai/api/v1/responses \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $OPENROUTER_API_KEY\" \\\n  -d '{\n  \"model\": \"~openai/gpt-sol-latest\",\n  \"input\": \"What is the meaning of life?\"\n}'",
       "src": "https://openrouter.ai/docs/quickstart.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "First request"
    },
    {
     "t": "tabs",
     "label": "First request",
     "items": [
      {
       "tab": "Request",
       "code": "curl https://openrouter.ai/api/v1/responses \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: Bearer $OPENROUTER_API_KEY\" \\\n  -d '{\n  \"model\": \"~openai/gpt-sol-latest\",\n  \"input\": \"What is the meaning of life?\"\n}'",
       "intro": "Request from the quickstart; response is the example from the API reference overview. The older /api/v1/chat/completions shape also works."
      },
      {
       "tab": "Response",
       "code": "{\n  \"id\": \"resp_1234567890\",\n  \"object\": \"response\",\n  \"created_at\": 1234567890,\n  \"model\": \"openai/gpt-5.2\",\n  \"status\": \"completed\",\n  \"output\": [\n    {\n      \"type\": \"message\",\n      \"id\": \"msg_abc123\",\n      \"status\": \"completed\",\n      \"role\": \"assistant\",\n      \"content\": [{ \"type\": \"output_text\", \"text\": \"The meaning of life is...\", \"annotations\": [] }]\n    }\n  ],\n  \"usage\": { \"input_tokens\": 12, \"output_tokens\": 45, \"total_tokens\": 57 }\n}"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "Creating a key with no credit limit and using it everywhere.",
       "fix": "Set a credit limit (and a reset period) on every key; use separate keys per app.",
       "why": "A leaked key or a runaway agent can spend the whole balance, auto top-ups included."
      },
      {
       "dont": "Adding a paid model after a :free model in the models list and expecting the call to stay free.",
       "fix": "List only :free models, or use openrouter/free on its own.",
       "why": "The fallback is billed at the paid model's price."
      },
      {
       "dont": "Treating an HTTP 200 as success without reading the body.",
       "fix": "Check the status and error fields in the body (and SSE events when streaming).",
       "why": "Errors that happen after the model started are sent with status 200."
      },
      {
       "dont": "Retrying every 402 in a loop.",
       "fix": "Read error.metadata.limit_source; only the in-flight budget case with a Retry-After header should be retried.",
       "why": "A 402 without the header means credits or the key limit are used up."
      },
      {
       "dont": "Using the OpenRouter MCP server as the way your app runs models.",
       "fix": "Use the MCP server while coding; call the API from the app.",
       "why": "The docs say the MCP is for build-time help."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Is there a free plan?",
       "a": "Yes. The free plan gives access to free models with a limit of 50 requests a day; buying at least 10 credits raises it to 1,000.",
       "evidence": {
        "url": "https://openrouter.ai/pricing",
        "quote": "Rate limits Free 50 requests/day"
       }
      },
      {
       "q": "Is it more expensive than going to each AI company directly?",
       "a": "Model prices are passed through without markup; you pay a fee when you buy credits (5.5% on the standard plan).",
       "evidence": {
        "url": "https://openrouter.ai/docs/faq.md",
        "quote": "We pass through the pricing of the underlying providers; there is no markup on inference pricing (however we do charge a fee when purchasing credits)."
       }
      },
      {
       "q": "Does OpenRouter keep my prompts?",
       "a": "Not by default. It keeps them only if you turn on logging or product use, or when content is flagged as possible child abuse material; request metadata is stored.",
       "evidence": {
        "url": "https://openrouter.ai/docs/guides/privacy/data-collection.md",
        "quote": "OpenRouter does store metadata (e.g. number of prompt and completion tokens, latency, etc) for each request."
       }
      },
      {
       "q": "Can I use my existing OpenAI code?",
       "a": "Yes; set the base address to https://openrouter.ai/api/v1 and use your OpenRouter key.",
       "evidence": {
        "url": "https://openrouter.ai/docs/api_reference/authentication.md",
        "quote": "If you're using the OpenAI Typescript SDK, set the api_base to https://openrouter.ai/api/v1 and the apiKey to your API key."
       }
      },
      {
       "q": "Do more keys give me higher limits?",
       "a": "No; limits are counted for the whole account, but different models have different limits.",
       "evidence": {
        "url": "https://openrouter.ai/docs/api_reference/limits.md",
        "quote": "Making additional accounts or API keys will not affect your rate limits, as we govern capacity globally."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Maker",
   "OpenRouter"
  ],
  [
   "Category",
   "LLM gateways and routers"
  ],
  [
   "Price",
   "Free plan"
  ],
  [
   "Official SDK",
   "npm @openrouter/sdk, PyPI openrouter"
  ],
  [
   "Latest SDK",
   "1.5.73 on npm"
  ],
  [
   "Agent check",
   "5 of 6"
  ],
  [
   "Pricing checked",
   "Nov 1, 2026"
  ]
 ],
 "good": [
  "You buy credits in advance; a 5.5% fee applies to each purchase on the standard plan, and model prices are passed through unchanged.",
  "Unused credits can expire one year after purchase.",
  "Some model makers may store your prompts or train on them; turn on the setting that avoids such providers if this matters."
 ],
 "checked_line": "Read by AgentGid from 30 official pages, card checked Nov 10, 2026; usage numbers update daily."
}