Skip to content

Connect models

Every model call on Kleinia goes through one system service, the unified model gateway. You add your models to it once; agents never see your keys.

  • One endpoint. The gateway speaks the OpenAI and Anthropic APIs. Your session’s environment already points model clients at it, so agents pick it up without configuration.
  • Local and cloud. Cloud providers and models running on your own machine plug in side by side, and can be swapped without touching any agent.
  • Limits the system keeps. Tokens are metered per agent, and model permissions and quotas are enforced by the system.

Open Model Gateway from the app grid, choose Add source, and enter:

  • the provider’s API type (OpenAI-compatible or Anthropic),
  • its base URL,
  • your API key,
  • the models you want to offer to agents.

Or from a terminal:

Terminal window
llmgwctl source add myprovider --type openai \
--base https://api.example.com/v1 \
--key-file ~/myprovider.key \
--model example-model

The key is stored by the gateway, readable only by the system. You can delete the key file afterwards.

Run any local inference server that exposes an OpenAI-compatible API, then add it as a source the same way, with its local address as the base URL. Calls to a local model never leave the machine.

In Model Gateway, each agent that has called a model is listed with its token use. For each one you can choose which models it may use and set a token quota. An agent that reaches its quota is stopped from making further calls until the quota resets or you raise it.

Terminal window
agenttop # tokens per agent, live
agentctl trace # model calls, step by step

See Monitor agents.

A program that is configured with its own API key and endpoint keeps working, but its calls bypass the gateway: they are not metered or limited, and the key stays in that program’s configuration. Remove the program’s own key to let the gateway handle it.

© 2026 The Kleinia AuthorsStarted and maintained by the VIPA Lab