Skip to navigation
DocsLibreChat

Apps and SDKs

LibreChat

In short: LibreChat supports the gateway as a custom endpoint in librechat.yaml, with the key in .env and the model list fetched from the API.

Updated View .md
On this page

LibreChat is an open-source, self-hosted chat interface for teams, configured with a librechat.yaml file next to its .env. The gateway goes in as a custom endpoint, so everyone on your LibreChat instance can use every model your key allows, without each person holding a provider key. Checked against LibreChat v0.8.x and its custom endpoint reference (October 2026).

You need an API key from API keys and this base URL:

Base URLhttps://api.oneaiapikey.com/v1

How do I add the endpoint to LibreChat?

Four steps add the gateway as a custom endpoint in LibreChat.

  1. Put the key in LibreChat’s .env file:

    .env
    ONEAIAPIKEY_API_KEY=<your One AI API Key key>
  2. Add the endpoint under endpoints.custom in librechat.yaml. Keep the rest of your file as it is.

    librechat.yaml
    endpoints:
      custom:
        - name: "One AI API Key"
          apiKey: "${ONEAIAPIKEY_API_KEY}"
          baseURL: "https://api.oneaiapikey.com/v1"
          models:
            default: ["z-ai-glm-5.3-flash:free", "qwen-qwen3.8-27b:free"]
            fetch: true
          titleConvo: true
          titleModel: "z-ai-glm-5.3-flash:free"
          modelDisplayLabel: "One AI API Key"
  3. Restart LibreChat. With Docker, make sure librechat.yaml is mounted into the container (LibreChat’s docs use a docker-compose.override.yml for this). Changes to the YAML file only apply after a restart.

  4. Choose One AI API Key in the endpoint menu, pick a model and send a message. The request shows up on your usage page.

What do the endpoint settings do?

Each setting in the YAML entry controls one part of how LibreChat uses the gateway.

  • name is the label in LibreChat’s endpoint selector. It must be unique and must not be a built-in endpoint name such as openAI or anthropic.
  • apiKey: “${ONEAIAPIKEY_API_KEY}” reads the key from .env, so it never sits in the YAML file. Set it to "user_provided" instead if each LibreChat user should paste their own One AI API Key key.
  • baseURL must end in /v1. LibreChat adds /chat/completions itself.
  • fetch: true loads the model list from GET /v1/models, so it shows exactly the models the key can use. default is the list shown if fetching fails.
  • titleModel is the model that names each conversation. A fast, cheap model is enough, and it saves money on every new chat because the title request runs once per conversation.
  • modelDisplayLabel is the name shown next to replies.

Can LibreChat use Claude through the Anthropic format?

Yes, as an optional second endpoint. LibreChat can also call a custom endpoint with Anthropic’s own Messages format by setting provider: "anthropic". The gateway accepts that format for Claude models at the base URL without /v1, because the client adds /v1/messages itself. Add it as a second entry under endpoints.custom:

librechat.yaml (second entry)
    - name: "One AI API Key Claude"
      provider: "anthropic"
      apiKey: "${ONEAIAPIKEY_API_KEY}"
      baseURL: "https://api.oneaiapikey.com"
      headers:
        anthropic-version: "2023-06-01"
      models:
        default: ["qwen-qwen3.8-27b:free", "z-ai-glm-5.3-flash:free"]
        fetch: false
      titleConvo: true
      titleModel: "z-ai-glm-5.3-flash:free"
      modelDisplayLabel: "One AI API Key Claude"
  • Only Claude model ids work on this endpoint. List them under default; LibreChat does not fetch the model list for Anthropic-format endpoints.
  • This is the only format in which Claude prompt caching can apply. Through chat completions the gateway translates the request and caching markers are not carried over (see Prompt caching).

How do I fix common LibreChat errors?

Most LibreChat errors come from the YAML file, the key or the base URL.

  • The endpoint does not appear: LibreChat did not load the file. Check its startup log for YAML errors (indentation is the usual cause) and that the file is mounted.
  • The model list is empty: the key is not valid, or it has a model list that limits what it can see. Check the key with the request on Authentication. Paid models are listed before a top-up, but return 402 with code paid_needs_deposit until you add $1 or more (see Errors).
  • 401 errors: the variable name in apiKey does not match the one in .env, or the key was revoked or has expired.
  • A model fails with 403: the key’s model list does not include it, or your balance is empty. See Errors.
  • 404 on every request: baseURL ends in /chat/completions or lacks /v1. On the Anthropic entry it is the other way round: no /v1.

↑ ↓ moveEnter openEsc close
New accounts$10 credit on sign-up
Claim $10 credit →