Get Started
API Reference
Base URL:https://chat-api.testnet.lightchain.ai (testnet). The OpenAI surface is under /v1; key management is under /api. The OpenAPI document is the machine-readable source of these shapes.
An API key goes in Authorization: Bearer lcai_...; a sign-in token goes in Authorization: Bearer <token>. The two are not interchangeable.
GET /v1/models
The models at least one worker serves right now. Needs an API key.
CodeJSON
id verbatim as model, colons included.
POST /v1/chat/completions
Request headers
Request body
Other OpenAI fields (temperature, max_tokens, top_p, ...) are accepted and ignored. Images, tools and function calling are not supported.
Response
An OpenAIchat.completion with one choice and no usage, plus the job it ran as:
CodeJSON
stream: true, the answer is text/event-stream, and the last chunk carries lightchain: see Streaming.
Response headers
Status codes
What to do about each code is in Errors.Wallet sign-in
Key management is authenticated by a Sign-In with Ethereum (EIP-4361) token: an ordinary message signature, no transaction. See API Keys for a full example.GET /api/auth/challenge?address=<address>
Returns { "nonce", "message" }. Sign message with the wallet (personal_sign).
POST /api/auth/verify
Body { "message", "signature" }. Returns { "token", "expiresAt", ... }. The token lasts an hour.