anonrouterdocs

LibreChat Setup with AnonRouter

Add AnonRouter to LibreChat with a ready-made custom endpoint YAML configuration, model discovery, user-provided keys, and privacy guidance.

LibreChat logoLibreChatCustom endpoint guide

LibreChat supports OpenAI-compatible services as custom endpoints. Add AnonRouter in librechat.yaml, keep the API key in .env, and restart LibreChat to make the provider appear in the endpoint selector.

Ready-made configuration

Copy the YAML and environment-variable snippets below, replace the example key, mount librechat.yaml when using Docker, and restart LibreChat.

Shared-key configuration

Add this custom endpoint to librechat.yaml:

version: 1.3.13
cache: true

endpoints:
  custom:
    - name: "AnonRouter"
      apiKey: "${ANONROUTER_API_KEY}"
      baseURL: "https://api.anonrouter.ai/v1"
      models:
        default:
          - "/auto"
          - "venice/venice-role-play-uncensored"
        fetch: true
      titleConvo: true
      titleModel: "/auto"
      modelDisplayLabel: "AnonRouter"

Then place the key in LibreChat's .env file:

ANONROUTER_API_KEY=ar_REPLACE_WITH_YOUR_API_KEY

The key must be an AnonRouter inference key with OpenAI-compatible access enabled. LibreChat sends it as a normal bearer credential.

Create an API key

The two models under default are safe initial entries for the selector. Because fetch: true asks the provider for its model list, LibreChat can also load the current ids from AnonRouter's authenticated GET /v1/models endpoint. Remove the roleplay example if it is not appropriate for your users.

Let each user provide a key

For a multi-user LibreChat deployment, replace the apiKey line with:

apiKey: "user_provided"

LibreChat then asks each user for their own provider key instead of sharing the server operator's AnonRouter key. Every user still needs an inference key with OpenAI-compatible access enabled.

Choose the credential model deliberately

An environment-variable key centralizes billing and makes every permitted LibreChat user spend from the same key. user_provided separates credentials and balances by user. In either case, use per-key credit limits and do not put a live key directly in librechat.yaml.

Docker mount

LibreChat's official Docker setup uses an override file to mount the config. Ensure docker-compose.override.yml contains:

services:
  api:
    volumes:
      - type: bind
        source: ./librechat.yaml
        target: /app/librechat.yaml

Apply the changes with:

docker compose down
docker compose up -d

For a non-Docker local installation, stop the backend and start it again after editing the files.

How the fields map to AnonRouter

LibreChat fieldPurpose
nameLabel shown in LibreChat's endpoint selector
apiKey.env substitution or user_provided sentinel
baseURLAnonRouter's OpenAI-compatible /v1 base URL
models.defaultInitial exact model ids shown by LibreChat
models.fetchFetch additional current ids from /v1/models
titleModelModel used when LibreChat generates conversation titles
modelDisplayLabelProvider label shown beside models

Do not set provider: "anthropic". AnonRouter exposes OpenAI-compatible Chat Completions even when the selected model was created by Anthropic.

Choose models

Use /auto when you want AnonRouter to select an eligible route for each request. Use exact provider-qualified ids when you want a fixed model.

Browse the live model catalog for current pricing, context windows, features, and privacy labels. For character chat, the catalog can be filtered to uncensored models.

Model availability changes over time. Keep fetch: true, and update stale entries under models.default if a pinned route is removed or renamed.

Feature compatibility

LibreChat featureAnonRouter behavior
Streaming chatSupported
Model discoverySupported with models.fetch: true
Tool callingSupported on routes that advertise tools
User-provided keysSupported by LibreChat configuration
Vision message arraysNot supported by AnonRouter's current compatibility contract
Legacy completionsNot supported

LibreChat supports more custom-endpoint options than AnonRouter honors. Begin with the minimal configuration above. If a feature fails, compare the emitted request with AnonRouter's compatibility contract.

Privacy and key storage

This custom endpoint uses compatibility mode, not the native single-use ticket flow. The compatibility broker temporarily receives key identity and plaintext request content together. Prompts and responses are not intentionally retained, but the request is not unlinkable at that hop.

LibreChat may add chat history, memories, tool output, file excerpts, or other enabled context to a request. Self-hosting LibreChat keeps its application data under your control; it does not prevent the content included in a model request from reaching AnonRouter and the selected provider.

Troubleshooting

AnonRouter does not appear in the selector

Check the three-file chain: librechat.yaml contains the endpoint, .env contains every referenced variable, and Docker mounts the YAML into /app/librechat.yaml. Then restart LibreChat and inspect docker compose logs api for YAML or environment errors.

401 or 403 response

Verify the complete ar_... key and enable OpenAI-compatible access on that inference key. With user_provided, confirm that the affected user saved the correct key.

No models appear

Keep models.fetch: true and include at least /auto under models.default. Confirm the base URL ends in /v1 and that the key can call GET /v1/models.

A model returns 404

Replace stale ids with current exact values from the model catalog. Display names are not API ids.

LibreChat setup FAQ

Can all users share one AnonRouter key?

Yes. Reference one .env variable in apiKey. That also shares its balance and spend limit, so it is not the safest default for an untrusted public server.

Can each user enter a separate key?

Yes. Set apiKey: "user_provided" for the custom endpoint.

What base URL should I use?

Use https://api.anonrouter.ai/v1.

Is an Anthropic model configured as an Anthropic endpoint?

No. Keep this as the default OpenAI-compatible custom endpoint. The wire format depends on AnonRouter's endpoint, not the company that created the model.

Sources and further reading

AnonRouter is an independent service and is not affiliated with LibreChat.

On this page