AISBF Logo AISBF

AI Service Broker Framework — AI Should Be Free

CoderAI documentation · source-backed from Nexlab/coderai

Connect CoderAI to AISBF broker

Use CoderAI as an AISBF provider over outbound WebSockets, including scopes, identity matching, registration, heartbeats, and request envelopes.

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.

Identity rule: 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&registration_token=<token>

User scope

wss://<aisbf-host>/api/u/<username>/coderai/wss?provider_id=<provider_id>&client_id=<client_id>&username=<username>&registration_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

  1. CoderAI opens an outbound WebSocket to the correct global or user-scoped endpoint.
  2. AISBF admits the socket and sends a registered event with session/provider/client identity.
  3. CoderAI sends an explicit register operation containing endpoint, transport, hardware inventory, studio endpoints, model capabilities, and performance metadata.
  4. CoderAI enters a long-lived receive loop for broker requests.
  5. 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.