Models + Router
Run on LiyaEngine's baseline models or bring your own keys for OpenAI, Anthropic, Gemini, Azure OpenAI, AWS Bedrock, OpenRouter, or any OpenAI-compatible endpoint — with automatic fallback on provider failure.
Model routing runs automatically inside the engine on every intent call. You can run on the baseline models LiyaEngine provides, bring your own provider keys, or use both.
- LiyaEngine baseline models need no provider account. They are included on every plan, and the model tier you can use grows with your plan (Standard, then Advanced, Premium and Frontier). Usage counts against your monthly token budget.
- Bring your own keys (BYOK) is available on every plan. BYOK requests bypass the platform token pool and model-tier limits, and inference cost goes to your own provider account.
With your own keys, configure multiple providers — 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
Supported providers
| Provider slot | Credential you supply | Notes |
|---|---|---|
openai | API key | |
anthropic | API key | |
gemini | API key | |
azure_openai | API key, your Azure endpoint, deployment ID and API version | Lets you pin inference to the Azure region you deploy to |
bedrock | AWS region plus either an access key pair or a cross-account IAM role ARN | Role assumption means no long-lived AWS secret is stored with LiyaEngine |
openrouter | API key | One key for many hosted models, including Mistral and Llama families |
custom | API key and an HTTPS baseUrl | Any OpenAI-compatible server — self-hosted or fine-tuned models. |
BYOK is available on every plan, including Free. Every credential is validated against the provider before it is saved.
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 checkAdd 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 only used to call your provider on your requests. The raw key itself is never returned in any API response — only a masked preview (first 3 and last 4 characters, e.g. sk-...ab12).
List providers:
{
"success": true,
"data": {
"providers": [
{ "provider": "anthropic", "configured": true, "isDefault": true, "keyPreview": "sk-...ab12", "lastValidatedAt": "2026-08-20T10:00:00Z", "lastHealthStatus": "healthy" },
{ "provider": "openai", "configured": true, "isDefault": false, "keyPreview": "sk-...cd34", "lastValidatedAt": "2026-08-20T10:00:00Z", "lastHealthStatus": "healthy" },
{ "provider": "gemini", "configured": false, "isDefault": false, "keyPreview": null, "lastValidatedAt": null, "lastHealthStatus": null }
]
}
}The list always includes every supported provider slot (openai, anthropic, gemini, azure_openai, bedrock, openrouter, custom) — configured tells you which ones actually have a saved credential.
How fallback works
- The engine calls your default provider first
- On any error — including auth failures — it immediately retries the next configured provider in order
- 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.