Last updated: 2026-11-07
Send your normal Darkbloom API requests to the provider your account owns —
free, end-to-end, through the same api.darkbloom.dev endpoint and SDK
configuration — by adding one request header or pinning an API key. For
operators who run a provider and also consume the network. Nothing changes on
the provider; the policy lives entirely on the coordinator
(coordinator/api/inference/self_route.go, resolveSelfRoutePolicy).
Self-route is not the local API: the local API is a socket on the provider Mac that your tools call directly (Only me or Both, me first); self-route is regular fleet traffic whose scheduler is told which machine may serve it.
- A provider linked to your account:
darkbloom loginon the Mac, thendarkbloom start(quickstart). Ownership is the account that linked the device (Provider.AccountID), stamped by the coordinator; the header cannot name a machine. - A consumer API key issued to the same account.
- The model you request downloaded and advertised on that machine
(
darkbloom models list).
-
Choose how to opt in. Three signals, resolved server-side from the authenticated identity; none comes from the request body:
Signal Scope Behaviour X-Darkbloom-Route: selfone request Exclusive. Only providers owned by the calling account; free; never falls back to the paid fleet — an explicit error if your machine cannot serve X-Darkbloom-Route: preferone request Prefer. Owned machine first (free when it serves), otherwise the paid fleet. Takes a normal balance reservation up front; billing is decided at settlement by who served API key self_route_only = trueevery request on that key Hard ceiling: exclusive self-route regardless of header. Set in the console key form (console-ui/src/components/api-keys/KeyForm.tsx) or PATCHthe key with{"self_route_only": true}(coordinator/api/access/keys/handlers.go)Header values are trimmed and case-insensitive. A key with
self_route_onlyignoresprefer. -
Send a request with the header:
curl https://api.darkbloom.dev/v1/chat/completions \ -H "Authorization: Bearer $DARKBLOOM_API_KEY" \ -H "X-Darkbloom-Route: self" \ -H "Content-Type: application/json" \ -d '{"model":"<model-id>","messages":[{"role":"user","content":"hi"}]}'
OpenAI SDKs accept extra headers (
default_headersin Python,defaultHeadersin Node). The header is invisible to the body schema, so it also works with a sealed private-text body. -
Discover what your machine serves with the same header.
GET /v1/modelsfollows the resolved route mode (coordinator/api/catalog/models_endpoints.go,HandleListModels): withself(or aself_route_onlykey) it lists only models on your online owned machines; header-less andpreferrequests see the public catalog.curl -s https://api.darkbloom.dev/v1/models \ -H "Authorization: Bearer $DARKBLOOM_API_KEY" -H "X-Darkbloom-Route: self"
-
Optionally keep the machine private.
private_only = trueunder[coordinator]inprovider.toml(provider-swift/Sources/ProviderCore/Config/ProviderConfig.swift,CoordinatorSettings.privateOnly) registers the provider as private-only: the coordinator serves it exclusively to the owner's self-route requests and never to the public fleet (gate reasonprivate_only, coordinator/registry/routing_eligibility.go). It then earns nothing; restart after changing the key. -
In the console, the chat "Use my machine" toggle sends
prefer(console-ui/src/lib/chat/stream.ts, forwarded upstream by console-ui/src/app/api/chat/route.ts); free-only routing there is the per-keyself_route_onlyceiling. Creating a My Machine only key in the API console adopts it as this browser's chat key when none is tracked (logout, chat401, and untracked auto-provision drop a leftoverdarkbloom_console_key_idso a stale id cannot block that adopt);POST /v1/auth/keys(console auto-provision) also inheritsself_route_onlywhen every active key on the account is already machine-only, so it cannot mint an unrestricted "use everything" key beside a machine-only one.
Self-route to an owned machine relaxes exactly two gates in the scheduler
(coordinator/registry/scheduler.go, providerPassesRoutingGatesLocked;
relaxTrust := owned && (pr.SelfRouteOnly || pr.PreferOwner)):
- the hardware-trust floor (
Registry.MinTrustLevel, set by EIGENINFERENCE_MIN_TRUST), so an un-enrolled orself_signedmachine of yours can serve you; - private-only admission, so a
private_onlyprovider is eligible.
Everything else still applies: liveness, challenge freshness, runtime
verification, private-text support, model/trait eligibility, and the APNs
code-identity gate once enforcement is switched on. Levels and flags are
explained in attestation; the mechanism in
architecture/security/attestation.md.
Requests served by an owned machine are free; prefer requests that fall back
to the fleet are charged normally. Settlement rules are in
architecture/billing.md.
darkbloom status # Trust: <level>, connected, models advertisedThen send a self request and confirm it succeeds while darkbloom logs -f
shows the request on your machine; with darkbloom stop the same request
returns 503 machine_offline.
Exclusive self-route fails fast with the real cause instead of queueing
(coordinator/api/inference/self_route.go, selfRouteUnavailable):
| Status / code | Meaning | Fix |
|---|---|---|
409 no_linked_machine |
No provider is linked to the account that owns the key | darkbloom login on the Mac under that account |
503 machine_offline (Retry-After: 30) |
Linked machine(s) exist but none is online | darkbloom start; darkbloom doctor for connection problems (troubleshooting) |
503 model_not_loaded (Retry-After: 15) |
Online, but no owned machine serves this model id | darkbloom start in a terminal and pick the model in its list, which downloads it if needed; darkbloom restart adds no model. List ids with the self header |
503 model_capability_unsupported |
Machine serves the model but not this request shape (inference-enforced tool_choice without the tool-constraint advertisement, media on a text-only build) |
darkbloom update; load a vision-capable build |
prefer requests are billed |
Your machine could not serve at that moment, so the fleet did | Check the same causes as above; use self if you never want the fallback |
Key with self_route_only returns 409/503 for every request |
The ceiling applies to all traffic on that key | Use a different key for public routing |
You don't need the header there. The Mac's local API sends a request it can't
take on with self (or prefer, when you chose "My Macs first") and your
account key from its Keychain, so tools keep one local URL and the local key:
see the local router.
prefer reserves the platform price of the request up front even when one of
your Macs answers (and charges nothing when one does), so a zero balance
(402, type insufficient_funds) or the key's spend cap (402, type
insufficient_quota) refuses it; the router then sends the request once more
with self, which needs neither.
- The local API — your Mac's own OpenAI-compatible address, for your tools.
- Attestation — trust levels and the flags self-route does not bypass.
- architecture/billing.md — free vs. charged settlement.
- CLI reference —
private_onlyand the otherprovider.tomlkeys.