Browse all docs

AI providers and keys

Connect OpenRouter

Create an OpenRouter API key, add credits, cap spend per key, connect it to SiteTrellis, test it, and fix common errors.

Last updated:

OpenRouter is a gateway that gives you access to models from many labs through a single account, a single balance and a single API key. It is a convenient way to try several models or to use models from providers that SiteTrellis does not integrate with directly. The details below describe OpenRouter as of writing; check its documentation for changes.

Create an account and add credit#

  1. Go to openrouter.ai and sign up.
  2. Open the credits page (Credits in your account menu) and buy credits with a card. OpenRouter is prepaid: when the balance reaches zero, paid models stop working. Some models are offered free of charge, but they are heavily rate limited and not suitable for a live website.

Create the API key#

  1. Open openrouter.ai/keys.
  2. Click Create Key and name it, for example "SiteTrellis production".
  3. Optionally set a credit limit on the key. This is the best protection for a key that serves a public website: once the key has spent that amount, it stops working even if your overall balance is larger.
  4. Copy the key; it is shown once. OpenRouter keys start with sk-or-.

Set spend limits#

Because OpenRouter is prepaid, your maximum exposure is the balance you load. On top of that, use the per-key credit limit and avoid enabling automatic top-ups unless you also have a per-key limit. Review the Activity page after the first days of real traffic to see which models cost what.

Paste it into SiteTrellis#

  1. Open AI providers in the dashboard and add a key.
  2. Choose OpenRouter, name the key, paste it and save.
  3. Wait for the status to show ok.
  4. In the agent's model section choose the key and pick a model from the dashboard's model list. OpenRouter model names combine a lab and a model; pick from the list rather than typing a name.

Things specific to OpenRouter#

  • Routing and availability. A single model can be served by several upstream providers with different prices, speeds and policies. OpenRouter chooses among them according to its routing rules and your account preferences.
  • Privacy preferences. In your OpenRouter account settings you can control logging of prompts and whether your requests may be routed to providers that retain or train on data. Set these before sending real customer conversations.
  • Tool support varies. Not every model supports tool calling, which SiteTrellis uses for lead capture, escalation and custom HTTP tools. The dashboard's model list marks tool support; choose one that supports tools if your agent needs them.
  • Fees. OpenRouter may charge a fee on credit purchases or on usage in addition to model prices. See its pricing page.

Typical errors#

Message or codeMeaningFix
401Invalid or disabled key.Create a new key and rotate it in.
402 insufficient creditsThe balance or the key's credit limit is used up.Add credits or raise the key limit, then Test.
403The model rejected the content (moderation) or your account is not allowed to use it.Check your settings or choose another model.
404 no endpoints foundNo upstream provider currently serves that model under your privacy settings.Relax the provider restrictions or choose another model.
429Rate limited, either by OpenRouter or the upstream provider (free models especially).Wait, use a paid model, or add a fallback step.
502, 503The upstream provider failed.Transient. A fallback step covers it.

Data handling#

Messages travel from SiteTrellis to OpenRouter and then to the upstream model provider, so two sets of terms apply. Read OpenRouter's privacy policy and the data policy of the models you select, and describe this in your own privacy policy. See also Security and privacy.

Related: AI keys overview.