Skip to main content
Bring Your Own Key (BYOK) lets you use your own search provider credentials when using Online Search (@online). Successful BYOK searches are not billed by Routeway for search usage — you pay the provider directly.
BYOK only affects search billing. Chat model token costs still apply as usual.

Platform search vs BYOK

By default, Routeway handles search for you when you append @online to a model ID. Daily limits and optional overage billing apply — see Server Tools pricing. With BYOK, Routeway calls your chosen provider (Tavily, Exa, or Valyu) using credentials you supply. When BYOK is used successfully, Routeway does not charge for that search. If BYOK is attempted but fails (invalid key, provider error, etc.), Routeway falls back to platform search. Standard platform search limits and billing apply for that search. Up to 3 search rounds can run per chat request when the model needs multiple lookups.

Supported providers

You can save one key per provider per account. Get API keys from your provider’s dashboard:

Quick start

  1. Open Dashboard → Settings and scroll to Web Search Keys.
  2. Add a key for Tavily, Exa, or Valyu.
  3. Enable Prefer BYOK so saved keys are used automatically on @online requests.
Then use @online as usual — no extra headers needed:

How search is chosen

Resolution order (highest priority first):
  1. Per-request keyX-Web-Search-API-Key (+ optional X-Web-Search-Provider)
  2. Saved key — only when Prefer BYOK is enabled in Settings, or via the X-Prefer-Web-Search-BYOK header
  3. Platform search — default fallback

Per-request headers

For integrations that need to pass a key on each request (for example, multi-tenant apps), add these headers to POST /v1/chat/completions alongside your normal Routeway auth. Behavior details:
  • X-Web-Search-API-Key present → BYOK is used for that request. Prefer BYOK does not need to be enabled.
  • X-Web-Search-Provider omitted with a request key → Tavily is assumed; keys starting with tvly- are inferred as Tavily.
  • X-Web-Search-Provider only (no API key) → selects which saved key to use, but only if Prefer BYOK is enabled (in Settings or via header).
  • Headers are case-insensitive (x-web-search-api-key works).
If multiple providers are saved and no X-Web-Search-Provider is set, priority is: tavily → exa → valyu.

Example: one-off Tavily key

Per-request keys are ideal for multi-tenant apps where each end user has their own search provider key. Keys sent in headers are never stored on Routeway’s servers.

Typical setups

Dashboard — save key, always BYOK

  1. Add your provider key under Settings → Web Search Keys
  2. Enable Prefer BYOK
  3. Call chat with model: "...@online" — no extra headers needed

Server integration — key per request

Send X-Web-Search-API-Key (+ X-Web-Search-Provider) on each @online chat request. Good for multi-tenant apps where each end user has their own search key.

Default platform search — no BYOK

Use @online with no BYOK headers and Prefer BYOK turned off. Routeway handles search; normal daily limits and overage apply. See Server Tools.

Security

Routeway treats search provider keys as sensitive credentials. Here’s how they’re handled:

Encrypted at rest

Keys saved in the dashboard are encrypted before storage and are never stored in plain text. They are decrypted only in memory when required to perform a search request and are not logged in plaintext.

Masked after save

After you add a key, only the last four characters are shown in the dashboard. The full value cannot be retrieved later.

Separate from API keys

Search provider keys are stored independently from your Routeway sk- API keys.

Per-request keys aren't stored

Keys sent via X-Web-Search-API-Key are used only for that request and are not saved to your account.
Routeway does not log or cache decrypted search provider keys. Keys are decrypted only when needed to make a search request to your chosen provider.

Best practices

  • Use the dashboard or headers — save keys in Settings → Web Search Keys, or pass them via X-Web-Search-API-Key. Never include provider keys in chat messages, prompts, or model strings.
  • Use environment variables — load keys from a secrets manager or environment variables in your application, not hardcoded in source code.
  • Rotate if exposed — if a key may have been leaked, update it immediately in the dashboard. The old key is replaced as soon as you save a new one.
  • Scope keys at the provider — create separate search API keys per environment (production, staging) in your provider’s dashboard when possible.

FAQ

Yes. BYOK only affects search billing. Model input and output tokens are billed at the usual rates for your chosen model.
Routeway falls back to platform search for that request. Standard platform search limits and billing apply for the fallback search.
Yes — one key per provider in Settings → Web Search Keys. If multiple are saved and no X-Web-Search-Provider is set, Routeway tries them in order: tavily → exa → valyu.
Save keys in the dashboard under Web Search Keys, or pass them per request via the X-Web-Search-API-Key header. Do not put provider keys in the chat message body or model string.
Open Dashboard → Settings, scroll to Web Search Keys, and update the key for your provider. The old key is replaced immediately.
Yes. Saved keys are encrypted at rest and only decrypted when needed to perform a search. The full key is never shown again after you save it — only a short hint (last four characters) is displayed in the dashboard. Routeway does not log decrypted keys.