Host an agent for a client
Give a client a key scoped to one of your agents. They call it over HTTPS, with no Skrun account.
How-to
This guide assumes you have deployed an agent; if not, start with Deploy your first agent. Below, <you>/<agent> is that agent.
How it works
You deploy your agent as usual. Your client gets an API key that runs that agent, and nothing else:
- Scope: one agent, yours. The key reaches none of your other agents, nor your account.
- Model key: you choose who pays for the model. Your client sends their own key, or you attach yours, which stays on the server, and your client needs none.
- Billing: between you and your client. You set your price, and the invoice stays yours.
Your client opens no account. The key is all they need, and they call your agent over HTTPS, from any stack.
Who pays for the model
Your client pays. Your client sends their own model key with each call (see What your client sends), and their model provider bills them. Leave the agent's caller-key policy at open, the default (Allowed in the agent's LLM keys card). A key they send takes precedence over yours; if you attached none, theirs is the only one. If your agent declares a fallback model from another provider and your client's key fails before any tool has run, the fallback uses your client's key for that provider, if they sent one, or else the key you attached for it, if you attached one. Under creator-only (below), your client sends no key, and none of this applies.
You pay. Attach your model key to the agent, as in Choose who pays for the model. Your client sends no key, and the model provider bills you.
To make every run use your key, refuse the keys a client might send: set the agent's caller-key policy to creator-only,
skrun llm-key policy creator-only --agent <you>/<agent>or, in the agent's LLM keys card, set Caller keys to My key only. A client who sends a key anyway gets 403 CALLER_KEY_NOT_ALLOWED.
Create the client’s key
In Settings, choose Create Key, name it after your client, and choose:
- Run-only: the key runs agents and does nothing else;
- One agent, then pick the agent;
- an expiration.
Or from the CLI:
skrun keys create --name acme --agent <you>/<agent> --run-only --expires-in 90Either way, the key is shown once. Hand it to your client over a channel you trust, such as a password manager's sharing, not a plain email or chat message.
What your client sends
A run is one HTTPS request:
curl -N https://api.skrun.sh/api/agents/<you>/<agent>/run \
-H "Authorization: Bearer $CLIENT_KEY" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"input": {"query": "…"}}'CLIENT_KEY holds the key you gave them (skrun_sk_…), and input carries the fields your agent's agent.yaml declares. The Accept: text/event-stream header is required: the answer is a stream of events, and the last one, run_complete, carries the result in output.
Two other ways:
- No stream on their side? They send a
webhook_url(a public HTTPS address) in the body, without theAcceptheader. The call answers202with arun_id, without waiting for the run, and the result is posted to that address when the run ends. - The SDK.
client.run()returns the result in one call, as in From your code, with your client's key as thetoken.
If your client pays for the model, they send their key in the X-LLM-API-Key header, as JSON that maps the provider to the key (X-LLM-API-Key: {"<provider>": "<their key>"}), or, with the SDK, as llmKeys in the options of client.run(). Under creator-only, that call is refused with 403 CALLER_KEY_NOT_ALLOWED.
What the key cannot do
- Run another of your agents:
403 KEY_SCOPE_FORBIDDEN. - Publish a new version of the agent:
403 KEY_SCOPE_FORBIDDEN. - Reach another account's agents: they answer
404, as if they did not exist. - Open your dashboard, create or revoke keys, or read your runs.
Revoke or rotate
In Settings, choose Revoke next to the key: it stops working at once, and a call made with it gets 401. To rotate without a gap, create the new key first, hand it over, then revoke the old one.
From the CLI, skrun keys list shows each key's id, and skrun keys revoke takes it:
skrun keys list
skrun keys revoke <id>When something fails
| You see | Why | Fix |
|---|---|---|
403 CALLER_BASE_URL_NOT_CONSENTED | Your client's X-LLM-Base-URL names an origin that is not where that provider's key goes, with or without a key: for the provider of your agent's main model, any origin but the agent's own endpoint (model.base_url in its agent.yaml); for any other provider, or for an agent with no endpoint of its own, any origin at all. Or your agent has an endpoint of its own, and your client sent their key for its main model without naming that endpoint. Their key never goes to an endpoint they did not choose | Your client sends X-LLM-Base-URL only to an agent that has an endpoint of its own, with one entry: the provider of its main model and the origin the error message gives (X-LLM-Base-URL: {"<provider>": "<origin>"}), beside their key. Or attach your own key, and your client sends none |
403 CALLER_BASE_URL_NOT_CONSENTEDYour client's
X-LLM-Base-URLnames an origin that is not where that provider's key goes, with or without a key: for the provider of your agent's main model, any origin but the agent's own endpoint (model.base_urlin itsagent.yaml); for any other provider, or for an agent with no endpoint of its own, any origin at all. Or your agent has an endpoint of its own, and your client sent their key for its main model without naming that endpoint. Their key never goes to an endpoint they did not chooseYour client sends
X-LLM-Base-URLonly to an agent that has an endpoint of its own, with one entry: the provider of its main model and the origin the error message gives (X-LLM-Base-URL: {"<provider>": "<origin>"}), beside their key. Or attach your own key, and your client sends none
Something else? See Get help.