07 · byok llm

Your key. Your audit. Your bill.

Register your own OpenAI, Anthropic, Gemini or Groq key with POST /v1/llm/keys, and every LLM call OriginChainDB makes runs on that key. Token usage lands on your provider's invoice at your own rate — there is no LLM line on your OriginChainDB bill.

why this matters

At scale, the LLM bill dwarfs the database bill.

A RAG product doing 1M /ask calls per month at $0.01 each runs $10,000 on someone's books. On a platform that marks up LLM tokens, that platform pockets a multiple of the actual provider cost. With BYOK, that $10,000 lands on your provider's invoice at your enterprise rate.

You also see every prompt, every completion, every token in your provider's dashboard. No intermediary, no batch reporting delay, no "trust us" line item.

configure a key
POST /v1/llm/keys
{
  "provider": "anthropic",
  "key":      "sk-ant-..."
}
providers
01
OpenAI

Chat completions.

02
Anthropic

Messages.

03
Gemini

Chat.

04
Groq

Fast inference for cost-sensitive workloads.

security model
Envelope-encrypted at rest

Your key is never stored in plaintext anywhere on our infrastructure.

Per-tenant isolation

Each tenant's keys are scoped and unreadable from other tenants.

Per-provider audit

Provider, model, prompt tokens, completion tokens, timestamp — visible in /usage.

Whitelist validation

For custom provider endpoints: hostname checks + private-IP block.

failover

Pin a fallback. Transparent retry on error or timeout.

Configure a fallback provider per tenant. If your primary provider returns an error, rate-limits you, or times out, the next request retries on the fallback. Audit captures which provider actually answered.