LibreChat custom endpoint setup
One custom endpoint in librechat.yaml puts every RelaySwitch model in LibreChat's endpoint selector. A models.default list keeps the picker short, and a small titleModel keeps the title requests cheap.
A LibreChat custom endpoint is one entry under endpoints.custom in librechat.yaml: a name, an API key, a base URL and a model list. Point it at https://api.relayswitch.io/v1 and the chat models on the Models page answer in LibreChat, billed per token to a prepaid balance.
The one decision is models.fetch. With it on, LibreChat reads the key's whole list, and the catalog holds 338 per-token models today. This guide lists the models by hand so the picker shows the ones you use, then covers the title model, what a chat costs and the check.
01What you need
- LibreChat running from its Docker Compose files, with
librechat.yamlin the project root. - A RelaySwitch key. Sign in with an email code at the console and create one. Keys start with
sk-relay-. - A balance. Top-ups start at $10, by card or crypto, with no subscription. Before the first top-up the console chat runs 12 free turns a day for comparing models.
02The custom endpoint in librechat.yaml
Put the key in .env and reference it from the YAML. LibreChat's docs call the environment-variable reference the recommended form for apiKey.
# .envRELAYSWITCH_KEY=sk-relay-...# librechat.yamlversion: 1.3.18cache: trueendpoints: custom: - name: 'RelaySwitch' apiKey: '${RELAYSWITCH_KEY}' baseURL: 'https://api.relayswitch.io/v1' models: default: - 'claude-sonnet-5-5' - 'gpt-5.5' - 'gemini-3.5-flash' - 'deepseek-v4-pro' - 'glm-5.3' fetch: false titleConvo: true titleModel: 'claude-haiku-5-5' modelDisplayLabel: 'RelaySwitch'name: the title in the endpoint selector. Required, unique.apiKey:${RELAYSWITCH_KEY}reads the variable from.env. A literal key oruser_provided(each user pastes their own) also work.baseURL:https://api.relayswitch.io/v1, with the/v1. LibreChat appends/chat/completionsitself, as its OpenAI-compatible examples (Mistral athttps://api.mistral.ai/v1) show. LeavedirectEndpointunset; that is for a URL that is already the full completions path.models.default: the ids in the picker. Required; withfetch: falsethis list is the picker.titleConvoandtitleModel: the automatic chat title and the model that writes it. Omitted, titles are written by the conversation's model.modelDisplayLabel: the label beside the AI icon in the chat; defaults to “AI”.
dropParams is not needed: the API accepts the sampling fields LibreChat sends. Add it only if a model page lists a parameter the model ignores.
03Mount the file and restart
Docker users mount librechat.yaml into the container. In docker-compose.override.yml, keep the volume mount uncommented:
# docker-compose.override.ymlservices: api: volumes: - type: bind source: ./librechat.yaml target: /app/librechat.yamlConfiguration changes take effect after a restart: docker compose down && docker compose up -d. The endpoint then appears in the selector under the name you gave it, with the models in models.default.
04Which models to list
Prices per million tokens and context windows, read from the live catalog when this page was built. The last column is one chat turn of 2,000 tokens in and 500 out.
| Model | Input | Output | Context | One turn |
|---|---|---|---|---|
| Claude Sonnet 5.5 | $1.20 | $3.00 | 1M tokens | $0.0039 |
| GPT-5.5 | $1.80 | $9.00 | 1.1M tokens | $0.0081 |
| Gemini 3.5 Flash | $1.50 | $9.00 | 1M tokens | $0.0075 |
| DeepSeek V4 Pro 0423 | $0.792 | $2.376 | 1M tokens | $0.0028 |
| GLM 5.3 | $0.3276 | $1.0296 | 1M tokens | $0.0012 |
| Claude Haiku 5.5 | $0.06 | $0.15 | 1M tokens | $0.0002 |
USD, read from the RelaySwitch catalog at build time. Context is the developer's stated window.
Use the id exactly as the Models page prints it, not the display name. To add a model later, add its id to models.default and restart. The Claude ids answer the OpenAI format here, so one endpoint covers them with the rest.
05What a chat costs
One new chat on Claude Sonnet 5.5, first reply only: 2,000 tokens in and 500 out come to $0.0039. LibreChat sends the whole conversation on every turn, so input grows with the thread.
With titleConvo on, each new chat adds one title request of about 1,000 tokens in and 20 out: $0.0013 on Claude Sonnet 5.5, $0.000063 on Claude Haiku 5.5. Over 50 new chats a day that is $0.063 against $0.0032, which is why the example sets titleModel.
Each request shows on the console's Usage page with its tokens and charge. See how pricing works for cached input and the rest of the billing rules.
06Check it
From the machine that runs LibreChat, list the models the key can call:
curl https://api.relayswitch.io/v1/models -H "Authorization: Bearer sk-relay-..."Then send one streamed request the way LibreChat does. -i prints the headers, including the request id.
curl -i https://api.relayswitch.io/v1/chat/completions \ -H "Authorization: Bearer sk-relay-..." \ -H "Content-Type: application/json" \ -d '{"model": "claude-sonnet-5-5", "messages": [{"role": "user", "content": "Say ok."}], "stream": true}'If both work and LibreChat does not, the problem is in the YAML or the mount. The API docs list every endpoint and error.
07Errors and fixes
- The endpoint is missing from the selector: the file is not mounted, or the YAML did not parse. Check the container log after
docker compose up. 401: the key is wrong, revoked or the variable name in.envdoes not match the one inapiKey.402: the balance is too low. Top up in the console and the next message goes through.404: a model id inmodels.defaultis not in the catalog, or a display name was typed where the id belongs.429: the key hit its rate limit. Wait and retry; every user of one endpoint shares one key and one limit.- Every model in the catalog shows up:
fetchis on. Set it tofalseand keep the list inmodels.default.
08Sources
Field names, the baseURL convention, the env-var reference and the mount are from LibreChat's own docs, read 2026-10-31: Custom Endpoint Object Structure and Custom Endpoints quick start. Prices are from the live catalog at build time.
Questions
- Where does the LibreChat custom endpoint go?
- In librechat.yaml in the project root, under endpoints.custom as one list item with name, apiKey, baseURL and models. Docker users mount the file through docker-compose.override.yml and restart.
- Does the baseURL include /v1?
- Yes: https://api.relayswitch.io/v1. LibreChat appends /chat/completions to it, the same way its Mistral and OpenRouter examples carry a /v1 base. The gateway also accepts a doubled /v1/v1 path, so a pasted URL with an extra segment still answers.
- Can each LibreChat user bring their own key?
- Yes. Set apiKey to user_provided and each user enters a key in the endpoint's settings; each pays from their own balance. With an env-var reference, every user of the instance chats on the one key you set.
- What is a LibreChat YAML example for an OpenAI-compatible API?
- The block above: version 1.3.18, endpoints.custom with name, apiKey as an env-var reference, baseURL https://api.relayswitch.io/v1, models.default listing the ids, fetch false, titleConvo true with a small titleModel, and modelDisplayLabel.
- How much does LibreChat cost on this key?
- LibreChat itself is free software; the tokens are what you pay, at the live prices in the table ($0.0039 for a first reply on Claude Sonnet 5.5 today), from a prepaid balance that starts at $10. No subscription.