Join our community of builders on Discord!

Lightchain AI Developer API

The Developer API is an OpenAI-compatible HTTP API for inference on the Lightchain AI network. Any OpenAI SDK works: change the base URL and the API key. Every completion runs as one job on chain: a worker serves it, the result is committed on chain, and the response names the job.
NetworkBase URLStatus
Testnet (chain 8200)https://chat-api.testnet.lightchain.ai/v1Live
Mainnet (chain 9200)not decided yetNot live

How a call works

CodeHTML
  1. Your app calls /v1/chat/completions with an API key, exactly as it would call OpenAI.
  2. The API picks a free session with a worker for that model, or opens one, and submits the call as a job on chain.
  3. The job's fee is paid in LCAI from your prepaid balance in the JobRegistry contract: by the API, under an on-chain allowance you gave it, or by a payment the call carries itself.
  4. The worker answers. The API decrypts the answer and returns it in OpenAI's shape, with a lightchain object naming the job, so you can check it on chain.

Pages

PageCovers
QuickstartThe first call from the OpenAI SDK, conversations, and what differs from OpenAI.
API KeysWallet sign-in, minting, capping, listing, revoking and deleting keys.
PaymentThe prepaid balance, the delegate path, and paying per call (experimental).
StreamingServer-sent events, and what happens when a stream fails.
LimitsPer-key and per-payer rate and concurrency, server-wide caps, per-call bounds.
ErrorsEvery status and code the API answers with, and what to do about each.
API ReferenceEvery route: request, response, headers and status codes.
Verifying an AnswerChecking a completion's job on chain, and what that proves.
Custody and TrustWhat the API can see and spend, and what your wallet signs.
TypeScript SDK@lightchainai/sdk: networks, automatic top-ups, paying per call.

Machine-readable

The API publishes its OpenAPI 3.0 document: JSON, YAML, browsable. The Developer API operations are under the Developer API and API keys tags.