Guides

LobeChat setup

LLMs Text

Configure LobeChat with the 4AICode API

LobeChat is an open-source ChatGPT-style frontend with custom OpenAI-compatible endpoints. Point it at 4AICode to use team balance and supported models.

Before you start

  1. Prepare sk-4ai-... from Tokens.
  2. Use https://relay.4aicode.com/v1 or https://relay.4aicode.net/v1.

Setup

Environment variables (self-hosted)

OPENAI_API_KEY=sk-4ai-xxxxxxxxxxxxxxxx
OPENAI_PROXY_URL=https://relay.4aicode.com/v1

Some LobeChat versions use OPENAI_API_BASE_URL / OPENAI_BASE_URL. The rule is the same: a 4AICode key plus a /v1 base URL.

UI settings

  1. Open Settings → Language models / OpenAI.
  2. Enter the API key and base URL (including /v1).
  3. Enable model IDs copied from the model catalog.
  4. Start a chat and confirm Usage.

Sample request

POST /v1/chat/completions HTTP/1.1
Host: relay.4aicode.com
Authorization: Bearer sk-4ai-xxxxxxxxxxxxxxxx
content-type: application/json

{
  "model": "gpt-5.6-luna",
  "messages": [{ "role": "user", "content": "ping" }]
}