Skip to content

LibreChat

One block in librechat.yaml puts the gateway behind LibreChat. Every conversation is then checked against your policies, charged to a team and recorded in Request logs, and people pick GPT, Claude and Gemini models from one endpoint. With user-provided keys, each person's calls show under their own name.

What it is

LibreChat is a self-hosted chat interface. Besides its built-in endpoints, it takes custom endpoints in librechat.yaml: any server that speaks the OpenAI format. LibreChat calls them from its server.

The two settings

Add a custom endpoint to librechat.yaml and restart LibreChat:

endpoints:
  custom:
    - name: "Vidai"
      apiKey: "${VIDAI_API_KEY}"          # or "user_provided": each person enters their own key
      baseURL: "https://<your-gateway>/v1"
      models:
        default: ["gpt-4o-mini", "claude-sonnet-4.5", "gemini-3.5-flash"]
        fetch: true                       # list the models the key may call
      titleConvo: true
      titleModel: "gpt-4o-mini"
      modelDisplayLabel: "Vidai"
# .env
VIDAI_API_KEY=vk_…
Key Value
baseURL https://<your-gateway>/v1 (LibreChat adds /chat/completions)
apiKey Your Vidai key (starts vk_), from an environment variable; or user_provided
models.default Names your organisation approved; shown if fetching fails
models.fetch true to fill the list from the gateway

The gateway's address is under Connect your app on the Keys page and in System › Settings › Gateway. You get the key from Keys › Issue a key; its secret is shown once.

Use a custom endpoint rather than pointing LibreChat's built-in OpenAI endpoint at the gateway: LibreChat has deprecated OPENAI_REVERSE_PROXY, and a custom endpoint shows as its own entry and can mix providers.

A minimal call

  1. Restart LibreChat after editing librechat.yaml and .env.
  2. In a new conversation, pick Vidai in the endpoint menu and a model, for example claude-sonnet-4.5.
  3. Send "Reply with exactly: ok". A short answer means the endpoint works.

Streaming

LibreChat streams every answer. A stream from Claude or Gemini arrives as OpenAI chunks; Vidai records the tokens and the cost either way.

Tool calls

LibreChat's agents and their tools (including MCP tools) travel as OpenAI tool calls and work on every provider the gateway translates to. Each round trip is its own call in Request logs.

Reading what the gateway did

LibreChat doesn't show response headers. Look the call up in Request logs: filter on Key, Model or Path (/v1/chat/completions). Cost is never in the answer.

Errors

LibreChat shows the gateway's error message in the conversation. Common ones: 401 invalid_api_key (wrong key, or a person's own key mistyped), 403 model_not_allowed, 403 content_guardrail_blocked (a guardrail stopped the message), 429 (a limit on the key or team). The full list is in Headers and errors.

Model names

With fetch: true, LibreChat calls GET /v1/models, which the gateway answers with exactly the models the key may call, named as your organisation approved them under Models in the Control room. With user-provided keys, each person sees their own key's models.

What goes through the gateway

LibreChat feature Through the gateway
Conversations, streaming, images in messages, agents and tools, conversation titles Yes, to OpenAI, Azure OpenAI, Anthropic, Gemini and Vertex AI models
File search (RAG) embeddings, if the RAG service is set to OpenAI with the gateway's address OpenAI and Azure OpenAI embedding models only
Speech, image generation, if set to OpenAI with the gateway's address OpenAI and Azure OpenAI models only
Other endpoints in LibreChat (built-in providers with their own keys) No: only endpoints pointed at the gateway pass through it

Check it works in a minute

Send "Reply with exactly: ok" on the Vidai endpoint, then open Request logs a few seconds later and filter on the endpoint's key.

Good to know

  • One key, every user. With apiKey: "${VIDAI_API_KEY}", everyone's calls use one key, show under it and are charged to the team it acts for. To split by team, add one custom endpoint per team, each with that team's key.
  • Each person's own key. With apiKey: "user_provided", each person issues a key in Keys › Issue a key and enters it in LibreChat for that endpoint. Their calls then show under them and are charged to their team.
  • headers placeholders such as {{LIBRECHAT_USER_ID}} add user headers; the gateway doesn't read them, so they don't change who a call is charged to.
  • titleConvo makes one extra call per conversation, with its own row in Request logs; point titleModel at a small model.
  • LibreChat's own docs: Custom endpoints.