LiyaEngine Docs
Platform

Models + Router

Bring your own keys for OpenAI, Anthropic, Gemini, or a custom endpoint — with automatic fallback on provider failure.

Dashboard

Model routing runs automatically inside the engine on every intent call. Configure multiple providers with your own API keys — if your primary provider fails, LiyaEngine falls back to your next configured provider. Same request, same response shape, zero code changes.

Replaces the old BYOK config

This supersedes the older single-provider providerConfig mechanism. The Models + Router API supports multiple named provider credentials with an explicit default and per-provider health checks.

Why bring your own keys

  • Cost control — inference costs hit your own provider account, not a shared pool
  • Data residency — route to a region-scoped endpoint (e.g. Azure OpenAI) to satisfy GDPR/HIPAA requirements
  • Provider preference — choose the model family that suits your use case
  • Resilience — a fallback chain means a single provider outage doesn't take you down

Provider credentials API

GET    /dashboard/models/providers                    # list configured providers
POST   /dashboard/models/providers/:provider           # add or update a provider's credentials
DELETE /dashboard/models/providers/:provider           # remove a provider
POST   /dashboard/models/providers/:provider/default    # set as the default (primary) provider
POST   /dashboard/models/providers/:provider/check      # run a live health check

Add a provider:

POST https://api.liyaengine.ai/dashboard/models/providers/anthropic
Authorization: Bearer <jwt>
Content-Type: application/json

{
  "apiKey": "sk-ant-...",
  "baseUrl": null
}

Keys are AES-256-GCM encrypted before storage and are never returned in any API response — not even masked.

List providers:

{
  "success": true,
  "data": {
    "providers": [
      { "provider": "anthropic", "isDefault": true, "status": "healthy", "lastCheckedAt": "2026-08-20T10:00:00Z" },
      { "provider": "openai", "isDefault": false, "status": "healthy", "lastCheckedAt": "2026-08-20T10:00:00Z" }
    ]
  }
}

How fallback works

  1. The engine calls your default provider first
  2. On any error — including auth failures — it immediately retries the next configured provider in order
  3. The whole retry happens inside the same request; your application sees one response either way

No retries to write, no error handling to build. Custom endpoints (OpenAI-compatible) are supported via baseUrl for self-hosted or fine-tuned model deployments.

On this page