One API key per tenant
Mint a key per tenant (POST /admin/keys with a name of the tenant’s own); the application presents the tenant’s key on every call (Eddy(api_key=...), new Eddy({ apiKey }), Eddy::new(..).api_key(Some(..))). Rotate by minting a new key and revoking the old (POST /admin/keys/{key_hash}/revoke).
The key’s rate limit
An admin gives a key a limit at mint (limits: { requests_per_minute, burst }) or later (POST /admin/keys/{key_hash}/limits; null clears it). A key without one takes the deployment’s default, SS_KEY_RATE_DEFAULT (for example 600/min,burst=100); unset, such keys are unlimited. Every /v1 and /admin call the key makes, by its header or from a page signed in with it, takes a token from its bucket; an empty bucket is 429 RATE_LIMITED with retry-after and x-ratelimit-limit / -remaining / -reset, before any compute. The limit holds per gateway replica (behind N replicas a key reaches up to N× it), and calls the engine makes in-process with the key (tools.call, an app function’s ss.call) count too; an agent run’s tools act under its own delegated token. The SDKs retry a 429 only when it carries retry-after, and surface it as retry_after / retryAfter once their retries are spent; a 429 without one (RESOURCE_LIMIT, SESSION_LIMIT) is not transient and raises at once.
The key’s usage is the meter
GET /v1/usage (eddy.usage() in every SDK) answers the caller’s own events — the operations, their cost in USD and CPU-milliseconds, newest first, summed. The meter is keyed by the key’s name, so two keys with one name share it: mint unique names. The operator’s /admin/usage lists every key. Bill from the meter. Spend is capped per org, not per key: under SS_BILLING=enforce an org whose credits are spent is refused 402 CREDITS_EXHAUSTED, and every admin-minted key draws on the one bootstrap org.
Result keys are content addresses
A result key is the content address of the request (the geometry, the material, the loads, the solver and its version) — it carries no tenant, no key and no clock. Two tenants solving the same body receive the same key and the same bytes, and the second is a cache hit. The cache is shared; what stays private is the association of a key with a tenant, which lives in the application (and in the engine’s usage log under the tenant’s key). Whether a key one tenant hands another reads for them is the deployment’s choice, below.Read grants
A deployment that requires API keys sets, withSS_GRANTS, who may use a content key (a result key, a blob id, a document key, an artifact id) or a job id named anywhere in a /v1 request — a path segment, a query value or the JSON body:
off(the default) andrecord: any identified caller holding a key reads what it names, so results can be shared and linked across tenants by key alone.recordonly writes grants and logs whatenforcewould refuse.enforce: a key reads only for the callers it was granted to — the principal that produced it (solved it, a cache hit on the same body included; uploaded the bytes; saved the document; registered the artifact; was answered the job id), the viewers of a saved project that names it, the members of the org it was produced in (not the shared bootstrap org every self-signup joins), and instance admins. Anyone else gets exactly what a key naming nothing gets — normally404, never403. A key handed to another tenant does not read for them: share through a project they can view, or let them solve the same body (a hit: the same key and bytes, now theirs too)./v1/runslists only the caller’s own runs; the export-all corpus routes are an instance admin’s.
SS_GRANTS_LEGACY_BEFORE_MS) stays readable by any identified holder of its key and is never listed; with no epoch it is an instance admin’s until its owner solves or uploads it again (a hit or a dedup, which grants). The shared cache still tells a tenant that someone solved the same body before them.
Jobs and webhooks
A job id is unguessable, and the record it answers carries the request’s content address, not the tenant. UnderSS_GRANTS=enforce the job (GET /v1/jobs/id) and what it finished with read for the caller it was answered to, by the rule above; otherwise for whoever holds its id. Per-tenant delivery is the webhook on the solve body: the tenant’s own url and secret, the signature keyed from that secret (x-eddy-signature: blake3=<hex>), so a receiver shared by tenants tells them apart by which secret verifies.
Offline tenants
A tenant running the engine as a library (eddy_native.Library) with a journal replays its solves to the fleet under its own key (Eddy(native=..., api_key=..., sync_to=..., journal=...), then sync()); the fleet meters the replays under that key and answers the offline result ids, so an offline tenant’s meter and results are the same as an online one’s.