Skip to content

LobeChat

LobeChat is an open-source chat client that can use any OpenAI-compatible service as a provider. Point it at MirAPI to chat with models from the catalogue, billed against your prepaid MirAPI balance.

Element Value
Base URL https://api.mirapi.ai/v1
API key Your MirAPI key (sk-...)
Model deepseek-chat

LobeChat appends /chat/completions (and other OpenAI paths) to the base URL itself, so the value must end in /v1 — do not add the chat path.

Set the proxy URL as an environment variable when you start the server:

Terminal window
OPENAI_PROXY_URL="https://api.mirapi.ai/v1"

LobeChat routes its OpenAI provider through this address. Then create or select an OpenAI provider in the UI and enter your MirAPI key (sk-...) as its key.

With the hosted or desktop app, set the proxy address in the UI instead:

  1. Open Settings → Language Model → OpenAI.
  2. Set Proxy address to:
https://api.mirapi.ai/v1
  1. Enter your MirAPI key (sk-...) as the API key.
  2. Enable deepseek-chat in the model list (add it manually if the list is empty).

Start a conversation with deepseek-chat and send:

Reply with exactly: connected to MirAPI

The reply should contain connected to MirAPI. If you get an error instead, see Troubleshooting.

LobeChat ships an OpenAI provider plus Anthropic and Google providers. Each talks to a different MirAPI endpoint:

Provider MirAPI base URL Auth accepted
OpenAI https://api.mirapi.ai/v1 Authorization: Bearer
Anthropic https://api.mirapi.ai x-api-key or Authorization: Bearer
Google (Gemini) https://api.mirapi.ai or https://api.mirapi.ai/v1beta x-goog-api-key or ?key=

The OpenAI provider is the simplest to set up and covers most models in the catalogue. All three protocols accept the same MirAPI key — only the auth header differs. See OpenAI compatibility for details.

  • 401 — the key is missing, invalid, or unknown. Check the API key in the provider settings.
  • 403 — the key is valid but the request was refused: the model is outside the key’s whitelist, a quota or IP allowlist applies, or the balance is empty. Top up in the console (https://console.mirapi.ai) and retry — the same key recovers immediately.
  • 413 / 429 / 500 — payload too large; rate-limited (retry with exponential backoff — responses carry no Retry-After header); or a server error where idempotent requests are safe to retry.

Chat is billed per token (input / output / cache read) at the model’s listed price, not per request; see Billing for the pricing model. Every error message ends with a request ID — attach it to any support ticket.

  • Keep /v1 in the proxy URL — LobeChat appends /chat/completions; adding it yourself produces a doubled path.
  • Use exact model IDs — model names come verbatim from GET /v1/models; enable only models your key is whitelisted for.
  • OPENAI_PROXY_URL vs the in-app settingOPENAI_PROXY_URL configures the OpenAI provider on a self-hosted (Docker) deployment; the in-app proxy address applies to the hosted or desktop app. If requests keep going elsewhere, fix the one that matches your setup and restart.
  • Model list is empty — if no models appear after saving, the proxy URL or key is wrong and the /v1/models call is failing. Check the request in the console billing log.