Expand description
LeanCTX Cloud model gateway key (POST /v1/gateway/key): a short-lived
key with which this computer’s sessions run on models from LeanCTX, paid
from the team’s balance.
Asked only when a local reader (LeanCTX Code) asks for it; the key is
handed to that reader and never written to disk, cached or logged
(GatewayKey’s Debug hides it). The reader keeps it in memory until
expires_at.
The cloud answers (contract W1):
200 {schema, base_url, key, expires_at, models}→GatewayAnswer::Ready(fields Cloud adds later are ignored;schema, when sent, must beKEY_SCHEMA);429 quota_exceeded(model_credit_usd_micros) →GatewayAnswer::Stopped;429 rate_limitedwithreason: gateway_keys(this computer already holds the most live keys Cloud allows) →GatewayAnswer::TooManyKeys;403 forbiddenor403 plan_required(no plan or trial) →GatewayAnswer::Forbidden;503 not_configured, or404from a cloud without the route →GatewayAnswer::NotConfigured.
Anything else is a CloudError.
Structs§
- Gateway
Key - A key the gateway handed out. Cloud answers grow additively, so fields
not named here (
schema,models, later ones) are not kept.
Enums§
- Gateway
Answer - What the gateway said.
Constants§
- BALANCE_
RESOURCE - The quota a stopped balance names.
- KEY_
LIMIT_ REASON - The
reasonof a429 rate_limitedrefused because this computer already holds the most live keys. - KEY_
SCHEMA - The
schemaof a key document.
Functions§
- request
- Ask the connected cloud for a gateway key.