Quilzomanual

LLM gateway: model routes, budgets in money and a privacy guard, for any AI agent

One gateway for every model call: which model answers, what each caller may spend, and what may leave in a prompt.

In the adminModels

The model gateway is where every model call from Quilzo goes: agents, chatbots, the writing assistant, and agents' own programs. It tries routes in order, charges each call to a caller at that route's prices, holds callers to their budgets, and masks personal data before a prompt reaches a route that may not receive it. Prompts are never recorded, only who asked, which route answered, and how much. AI agents built in any framework can use it too, with their memory (see Agents built anywhere).

The quickest start: one model

With no routes declared, every call goes to the model in two environment variables. Any OpenAI-compatible endpoint works: Ollama, vLLM, LM Studio, llama.cpp, or a hosted provider.

export QUILZO_MODEL_URL=http://127.0.0.1:11434/v1
export QUILZO_MODEL=MODEL

MODEL is the name the endpoint gives the model you chose. A key, if the endpoint needs one, goes in QUILZO_MODEL_KEY. Quilzo sends a key only over https, or to a model on this machine.

Add routes, in fallback order

  1. Add each model as a route

    Open Administration › Models and fill in Add a route: a name, the provider, the model name, the sealed credential holding its key (never the key itself), and what a million tokens cost there.

    Quilzo knows more than forty providers by profile: runtimes on this machine or your network, model makers, open-model hosts, routers to many providers, cloud platforms and regional providers. Each profile gives the provider's address, how it takes its key, and what it says it does with what it is sent: whether it trains on it, how long it keeps it, and where it is processed. The Provider list on the Models screen offers the same profiles.

    quilzo gateway providers
    quilzo gateway providers mistral-eu

    A route that names a provider takes the profile's address and the way it sends its key, and reaches that provider's host and nothing else. A route given another host fails every call, so a typo or a planted address cannot carry a key off. Keep the key sealed and name it with --key-secret; the profile suggests the name:

    quilzo gateway currency GBP
    quilzo secret set mistral < keyfile
    quilzo gateway route add hosted-eu --provider mistral-eu --model MODEL --key-secret mistral \
      --price-in 2.50 --price-out 10.00

    A providers.json in the store's .quilzo folder adds the operator's own profiles, and one with a built-in profile's id replaces it. Any OpenAI-compatible endpoint also works by its address, with its key in an environment variable:

    quilzo gateway route add on-premises --url http://127.0.0.1:11434/v1 --model MODEL \
      --personal --price-in 0.05 --price-out 0.20 --first
    quilzo gateway route add hosted --url https://models.example.com/v1 --model example-large \
      --key-env EXAMPLE_API_KEY --price-in 2.50 --price-out 10.00

    Mark a route --personal only if it may receive personal data: it runs on your own machines, or you have an agreement with the provider to process it. Text for any other route has personal data masked on the way out. A picture, such as a screenshot an agent takes, cannot be checked, so it goes only to a route marked --personal.

    A route's model is sent the conversation and the caller's output limit, and nothing else unless the route asks for it, because current frontier models refuse fields older ones took. Set these only for a model that needs them, under What this model is sent or with:

    OptionSends
    --max-tokens-field max_completion_tokensThe output limit under that name, for OpenAI's reasoning models. The default is max_tokens.
    --temperature T, --top-p PThat sampling on every call. Anthropic's Messages API refuses both on every model, so a route to it with either is refused where the route is made.
    --timeout 300sNothing; it lets one call take that long, for a model that reasons at length. The default is two minutes.
    --auto-tool-choiceauto where a caller forces a tool, for a model that refuses a forced choice.
    --effort low|medium|high|xhigh|maxHow hard the model thinks (How hard it thinks).
    --geo usThat the model runs in the US only (Where it may run). global is the provider's default.
    --server-fallbackThat a request the model declines may be answered by another of the provider's models, for the models that take it.
    quilzo gateway route add reasoning --url https://models.example.com/v1 --model example-reasoner \
      --key-env EXAMPLE_API_KEY --max-tokens-field max_completion_tokens --timeout 300s

    The last three are for a provider spoken to in its own Messages API, and are refused for any other. quilzo gateway providers anthropic says that its profile speaks it:

    quilzo secret set anthropic < keyfile
    quilzo gateway route add careful --provider anthropic --model MODEL --key-secret anthropic \
      --effort high --geo us --server-fallback

    A request the model's safeguards decline goes back to whoever asked, with the provider's reason when it gives one. It is not sent to the next route and rests nothing: routing round a provider's safeguard is not a fallback.

  2. Check the order

    Routes are tried in the order shown. A route that cannot answer three times in a row rests for a minute while the next one answers: no reply, a timeout, a rate limit, an outage, or a key or account the provider refused. A request the provider refuses as malformed (400, 413 or 422) goes back to the caller with the provider's reason; it is not sent to the next route, which would refuse it alike, and it rests nothing. Try first moves a route to the top.

    The Models screen with two routes: on-premises, which may receive personal data, and hosted, where personal data is masked and the key is not set
    Two routes. Personal data is sent to the first and masked for the second.
  3. Set budgets

    Under Budgets, give a caller limits per minute, per day and per month: calls, characters, tokens and money. A caller is agent:NAME, person:NAME, chatbot:NAME, door:NAME for a person's agents built elsewhere, reviewer:AGENT for the reviews of an agent's actions, or * for everybody without a budget of their own. A name may be the email address single sign-on gives a person, such as person:dana@quilzo.io.

    Whatever a person sets off is charged to person:NAME as well as to its own caller: agent runs and their reviews, drafts, features, evolution, research ideas and reflections. A budget on a person bounds all of it.

    quilzo gateway budget agent:returns-editor --money-per-day 5.00 --money-per-month 60.00
    quilzo gateway budget agent:concierge --per-minute 20 --tokens-per-day 200000
    quilzo gateway budget '*' --money-per-day 20.00

    A chatbot over its daily budget answers from its pages without the model, which gives a plainer answer rather than an outage. Each agent run also has its own cap in its declaration (see Limits that hold).

  4. Watch what each caller spent

    Today shows every caller's characters, tokens, money, calls, failures and refusals, for the day and the month.

    Today's spending by caller: person dana, agent help-desk and agent returns-editor, with tokens and money, and the budgets table below
    Spending by caller, against their budgets.
    quilzo gateway status
    routes, in fallback order
      on-premises  http://127.0.0.1:11434/v1 MODEL  no key needed; may receive personal data
      hosted  https://models.example.com/v1 example-large  key in $EXAMPLE_API_KEY; personal data masked
    today
      agent:returns-editor  4463 characters no daily limit, 3 call(s), 0 failed, 0 refused
        1112 tokens, 0.000067 GBP today of 5.00, 0.000067 this month of 60.00

Routes for pictures, embeddings, voice and video

A route answers in words unless it is added as one of these. Each is used for its one job and nothing else, under the callers' budgets and in the same record as words:

OptionOn the Models screenWhat uses it
--draws, priced with --price-pictureIt draws pictures, Price of a picturequilzo media generate. Add --ask-base64 (Ask it for the picture itself) for an endpoint that otherwise answers with a link, which is never fetched.
--embedsIt makes embeddingsChatbots that find passages by meaning, once it is named in chatbot.embeddings (see Chatbots).
--speaksIt reads text aloudquilzo media speak. Text holding personal data goes only to a route that may receive it, since a voice cannot leave it out.
--transcribes, priced with --price-minuteIt transcribes recordings, Price of a minute of recordingquilzo media transcribe. Voices cannot be masked, so it is sent a recording only when it is marked --personal.
--films, priced with --price-videoThe command line onlyquilzo media film, through a provider that makes video: google-veo or fal.
quilzo gateway route add pictures --provider openai --model MODEL --key-secret openai \
  --draws --price-picture 0.04
quilzo gateway route add meaning --provider openai --model MODEL --key-secret openai \
  --embeds --price-in 0.02

The privacy guard

Before a prompt leaves for a route that may not receive personal data, Quilzo replaces each personal value with a placeholder such as <quilzo:email:1>. The same value gets the same placeholder every time, so the model can still tell one customer from another. The placeholders are swapped back in the answer, so it reads as if nothing was taken out. The model never sees a value, and the record of what was masked holds only counts by kind.

MaskedFor which routes
Email addresses (except your own site's domains), telephone numbers, IBANsRoutes not marked --personal
National identity numbers: US SSN, UK National Insurance, Spanish DNI and NIE, Indian Aadhaar, Brazilian CPF, Canadian SIN, each checked with its own rulesRoutes not marked --personal
Payment card numbers and credentials (API keys, tokens, private keys)Every route, including personal ones

A credential caught in a prompt is also a sign that a key was pasted somewhere it should not have been, so the shield's secret-in-prompt playbook asks the security team's tools that read this log to open a case for somebody to look at it and rotate it (see The shield). A hosted route allowed to receive personal data is a posture finding until an agreement is on record.

Invisible text never reaches a model

Characters that draw nothing, such as the Unicode tag block, zero-width characters and bidirectional controls, are taken out of every text before any model reads it. They are a known way to hide an instruction from the person reviewing a page while a model still reads it.

Agents built anywhere

An AI agent made with any framework talks to its model in OpenAI's shape or Anthropic's. Quilzo answers both at /v1 on the admin, through this gateway: the provider's key stays in Quilzo, and each call is charged to the person whose Quilzo token the agent carries, against their budget, with personal data masked and invisible text taken out, and recorded in the signed log. The agent changes its base address and its key, nothing else.

  1. Turn it on

    It is off until an administrator turns it on, with a reason the log keeps:

    quilzo config set models.remote true --accept-risk "support agents built in LangGraph use our models"

    It answers only in a store with an access policy, and only for a token whose person may draft (author or above).

  2. Give the agent a token as its key

    quilzo token issue support-agent --principal dana --role author
    ClientBase addressEndpoint
    OpenAI's chat completionshttps://YOUR-ADMIN/v1POST /v1/chat/completions
    OpenAI's responseshttps://YOUR-ADMIN/v1POST /v1/responses
    Anthropic's messageshttps://YOUR-ADMINPOST /v1/messages

    The key goes where each client puts it: Authorization: Bearer or x-api-key. A token an app was given through OAuth for /mcp does not work here, and neither does a browser session.

  3. Name a model

    quilzo is the gateway, which picks the route. agent/NAME names one of this store's agents and brings its memory. GET /v1/models lists what the token may name.

import os
from openai import OpenAI
client = OpenAI(base_url="https://quilzo.example.com/v1", api_key=os.environ["QUILZO_TOKEN"])
reply = client.chat.completions.create(model="agent/concierge",
    messages=[{"role": "user", "content": "When does my team ship?"}])

Each framework's own lines are on Agent frameworks.

Memory at the gateway

Naming an agent that declares memory (see Agent memory) works as a run of that agent does, under its declaration as bounded for the token's person:

  • With recall, what it remembers about the person is put into the conversation before the model reads it, marked as information and not instructions: what matches what the person said, then its most recent facts about them.
  • With remember, the model is offered one tool, quilzo_remember. Quilzo performs it and asks the model again, so the agent gets an answer and never sees the tool. A fact with a key replaces the older one.
  • Quilzo cannot see what an agent built elsewhere read, so what it remembers is kept as unreviewed, at most 30 days. When the conversation carried a tool's results or a picture, it is held until a person confirms it, the same rule as a run here.

The person sees and forgets all of it on the Memory screen, as with any agent.

What it charges, records and refuses

  • A call is charged twice, each against its own budget: to door:PERSON, or to agent:NAME when an agent was named, and to person:PERSON. Set a budget for either as for any caller (see Add routes, in fallback order).
  • Every call, refusals included, is a model.door record: who it acted for, which agent, the tokens, and the ids of what was recalled and remembered. Never the conversation.
  • Refused, with the reason: a picture given as a web address (the provider would fetch it), a tool the provider runs itself, and a responses request continuing a conversation kept elsewhere (previous_response_id). Nothing here keeps conversations, so an agent sends the whole of it each time, as every SDK can.
  • A request the route's provider refuses as malformed is answered with the provider's status (400, 413 or 422) and its reason, as the caller's to fix.
  • A tool choice naming one tool is passed on as that tool, in every client's shape; a choice of a tool the request does not offer is refused.
  • A request that asks for a stream gets the whole answer as one stream, in the events its client expects.
  • The shield can turn it off for a while (models), as it can the agent interface.

Next