Skip to main content

Custom

Use this when the real endpoint is OpenAI-compatible but does not map cleanly to one of Loong’s built-in provider families.

At A Glance

FieldValue
Built-in kindcustom
Provider groupGateway And Compatibility Providers
Protocol familyopenai_chat_completions
Feature familyopenai_compatible
Auth schemebearer
Credential envsCUSTOM_PROVIDER_API_KEY
Aliasesopenai_custom, custom_openai
Default base URLhttps://<openai-compatible-host>/v1
Request endpointhttps://<openai-compatible-host>/v1/chat/completions
Models endpointhttps://<openai-compatible-host>/v1/models

Minimal Config

active_provider = "custom"

[providers.custom]
kind = "custom"
base_url = "https://<openai-compatible-host>/v1"
api_key = { env = "CUSTOM_PROVIDER_API_KEY" }
model = "auto"

Verify It

loong doctor
loong list-models
loong ask --message "Say hello and name the active provider."
If list-models is unreliable for this account or region, pin an explicit provider.model or add preferred_models instead of leaving recovery implicit.

Auth And Routing Contract

ContractValue
Auth optionalno
Model probe auth optionalno
Default API key envCUSTOM_PROVIDER_API_KEY
OAuth envnone
Primary request routehttps://<openai-compatible-host>/v1/chat/completions
Primary model-catalog routehttps://<openai-compatible-host>/v1/models

Operator Notes

  • custom requires tenant-scoped base_url configuration: replace <openai-compatible-host> in provider.base_url with your real OpenAI-compatible endpoint root such as https://api.example.com/v1; current template: https://<openai-compatible-host>/v1.
  • Alternative auth path: add Authorization / X-API-Key in provider.headers.
  • Use provider.headers only when the upstream auth contract does not fit the default bearer-token path.