Purpose
The broker integration lets a CoderAI instance behind NAT connect outward to AISBF, authenticate as a provider, advertise capabilities and hardware, receive work, execute locally, and return success, error, binary, or streaming envelopes.
provider_id, client_id, username, and registration_token must match the AISBF provider config. A connected socket with a mismatched client_id can still fail to route requests.Broker endpoints
Global scope
wss://<aisbf-host>/api/coderai/wss?provider_id=<provider_id>&client_id=<client_id>&username=global®istration_token=<token>User scope
wss://<aisbf-host>/api/u/<username>/coderai/wss?provider_id=<provider_id>&client_id=<client_id>&username=<username>®istration_token=<token>Use wss:// whenever AISBF is exposed through HTTPS or TLS termination. Use the externally visible URL, not an internal bind address.
CoderAI config shape
{"broker":{"enabled":true,"base_url":"https://aisbf.cloud","scope":"user","username":"alice","provider_id":"coderai-local","client_id":"workstation-01","registration_token":"provider-scoped-secret","transport":"websocket"}}Session lifecycle
- CoderAI opens an outbound WebSocket to the correct global or user-scoped endpoint.
- AISBF admits the socket and sends a
registeredevent with session/provider/client identity. - CoderAI sends an explicit
registeroperation containing endpoint, transport, hardware inventory, studio endpoints, model capabilities, and performance metadata. - CoderAI enters a long-lived receive loop for broker requests.
- Heartbeat support keeps the session fresh; reconnect uses backoff and the same stable
client_id.
Using broker mode to sell model access
For the AISBF market/access layer, broker mode is the seller-friendly path for local GPUs: CoderAI keeps the model runtime local, while AISBF handles public access, buyer tokens, routing, quotas, and failover.
Seller owns the worker
The provider owner controls the CoderAI machine, its models, and its registration token.
AISBF owns access
Consumers call AISBF routes rather than the raw CoderAI API. That keeps credentials and policy centralized.
Market-ready protocol
Stable provider_id and client_id let AISBF track which seller worker is connected and route work safely.
Supported broker operations
models.list
Return configured CoderAI models and metadata for AISBF discovery.
chat.completions
Proxy OpenAI-compatible chat completion work to the local CoderAI API.
capabilities
Return hardware, studio, endpoint, and model capability metadata.
proxy
Forward arbitrary supported HTTP-like operations and return JSON, binary, or streaming responses.
AISBF