Add BYOK to an Existing App

Attach your own provider keys to AnyRouter and change one base URL, so requests bill to your provider accounts.

Keep paying your provider directly while moving traffic through AnyRouter for logs, analytics, routing, and presets. BYOK requests have no per-token AnyRouter fee and never draw down credits; requests with no matching BYOK key use credits at the listed model price.

  1. Add your provider key (OpenAI, Anthropic, and others) at Settings → BYOK. It is encrypted at rest.

  2. Create an sk-ar- key in Dashboard → Keys. This is the only key your app sends.

  3. Change the base URL and key. The request body stays the same:

    import OpenAI from "openai"
    
    const client = new OpenAI({
      baseURL: "https://anyrouter.dev/api/v1",
      apiKey: process.env.ANYROUTER_API_KEY, // sk-ar-v1-...
    })
    
    const completion = await client.chat.completions.create({
      model: "openai/gpt-5.4-mini",
      messages: [{ role: "user", content: "Hello from my app" }],
    })

    This request is served with your OpenAI account.

  4. Optional: keep credits funded and set "provider": { "allow_fallbacks": true } so a rate-limited or out-of-quota BYOK provider falls back to a credit-billed upstream. See Smart Routing.

AnyRouter routes requests to third-party models. Models and outputs are provided as is, with no warranty; you use them at your own risk. Disclaimer