Skip to content
← All docs

BYOK setup

Bring your own Anthropic or OpenAI key to Niyra. Reduce cost, control your vendor budget, run on your enterprise terms.

What is BYOK

By default, Niyra uses our hosted LLM access — you pay in credits, we pay the providers. With BYOK, you plug in your own Anthropic or OpenAI API key and Niyra runs on your vendor account. Credits don't tick down for LLM calls; you pay your provider directly.

Available on Pro and Alpha plans.

Why use BYOK

  • Cost control at scale. If you're a heavy user, your vendor bill may be lower than credit equivalents (especially with Anthropic enterprise rates or OpenAI volume discounts).
  • Enterprise terms. Some employers require all LLM use to go through their account. BYOK respects that.
  • Apex mode access. Apex / Fable 5 (Claude Opus 4 tier) is BYOK-only.
  • No vendor lock-in. Your data, your contract.

Add a key

  1. Dashboard → Settings → BYOK.
  2. Pick a provider: Anthropic or OpenAI.
  3. Paste your key. Niyra immediately validates it (sends a single test prompt).
  4. Done — Niyra starts routing through your key on the next message.

Your key is encrypted at rest (AES-256-GCM). The encryption key lives in Fly secrets, separate from the database. Decrypted only inside the request handler. Never logged, never returned over the API.

Validate / rotate

  • Validate: Settings → BYOK → "Test key". One round-trip; doesn't burn meaningful tokens.
  • Rotate: Just paste a new key, the old one is overwritten.
  • Remove: Click "Disconnect". Niyra reverts to the credit pool.

What still costs credits

BYOK covers LLM calls. Other things still cost credits:

  • Embeddings (memory search).
  • Tool calls via Composio (Gmail, Slack, etc.).
  • Voice (TTS / STT).
  • Apollo enrichment.
  • Outbound phone calls (telephony charges).

This is usually <10% of total cost; LLM is the dominant component.

Token refresh

Niyra's token refresh daemon polls every 5 minutes to refresh OAuth tokens proactively (60s before expiry). Your BYOK API key isn't OAuth — it's a long-lived key — so no refresh needed. You're responsible for rotating it when your provider asks.

Limits

  • One key per provider. Anthropic + OpenAI = two keys.
  • Anthropic models supported: Sonnet, Opus, Haiku (all 4.x generations). Apex (Fable 5) is BYOK-only.
  • OpenAI models supported: gpt-4.x, gpt-5.x, embeddings. Voice models also wired up.
  • No third-party providers via BYOK yet (no Together, Groq, etc.). Use a Niyra-hosted tier instead.

Troubleshooting

  • "Key invalid" — Paste it without quotes. Anthropic keys start with sk-ant-, OpenAI keys with sk-proj- or sk-.
  • "Rate limited" — Your vendor limit was hit. Wait or upgrade your tier with the provider.
  • Quota exhausted — Same — top up your provider account.
  • Apex doesn't appear — Apex is alpha-gated. Email hi@niyra.ai for access.
For AI:.md.txt