Skip to content

LibreChat

LibreChat supports custom OpenAI-compatible endpoints. The common approach is to define the endpoint in librechat.yaml and store the key in .env.

Preparation

FieldValue
API URL / Base URLhttps://n.tokeness.dev/v1
API KeyA key created in the Tokeness console
ModelsFull model names copied from the Tokeness model catalog

LibreChat is typically used for multi-user chat. In production, do not expose the Tokeness key to the frontend and do not commit it to a repository.

File Responsibilities

A LibreChat custom endpoint typically involves three files:

FilePurpose
librechat.yamlDefines the custom endpoint, model list, and display name
.envStores sensitive information such as API keys
docker-compose.override.ymlMounts librechat.yaml in Docker deployments

If you are not using Docker, place librechat.yaml wherever your deployment can read it.

Configure .env

Add the following to .env:

bash
TOKENESS_API_KEY=your Tokeness API key

Do not put the real key in librechat.yaml.

Configure librechat.yaml

Below is a minimal configuration. Replace the model names with the full model names from the Tokeness model catalog.

yaml
version: 1.2.1

endpoints:
  custom:
    - name: "Tokeness"
      apiKey: "${TOKENESS_API_KEY}"
      baseURL: "https://n.tokeness.dev/v1"
      models:
        default:
          - "YOUR_MODEL_NAME"
        fetch: false
      titleConvo: true
      titleModel: "YOUR_MODEL_NAME"
      modelDisplayLabel: "Tokeness"

Field descriptions:

FieldDescription
nameThe endpoint name displayed in LibreChat
apiKeyReads the Tokeness key from .env
baseURLThe Tokeness OpenAI-compatible Base URL
models.defaultModels available in the UI
models.fetchWhen set to false, uses the manual model list
titleModelThe model used to generate conversation titles

To expose multiple models:

yaml
models:
  default:
    - "MODEL_A"
    - "MODEL_B"
    - "MODEL_C"
  fetch: false

Docker Mount Configuration

If you use Docker Compose, you can mount the configuration in docker-compose.override.yml:

yaml
services:
  api:
    volumes:
      - ./librechat.yaml:/app/librechat.yaml

After making changes, restart:

bash
docker compose down
docker compose up -d

Let Users Provide Their Own Key

For an internal team deployment where each user should use their own Tokeness key, change apiKey to:

yaml
apiKey: "user_provided"

In this mode, users enter their own key in the LibreChat UI. It suits scenarios where multiple people share a LibreChat instance but you do not want the server to hold a shared key.

Verification

  1. Restart LibreChat.
  2. Select Tokeness in the model endpoint selector.
  3. Select a configured model.
  4. Send "reply with ok only".
  5. Open the Tokeness usage logs and confirm a request arrived.

Troubleshooting

SymptomAction
Tokeness endpoint not visibleCheck whether librechat.yaml was mounted successfully and restart the container
401Check that TOKENESS_API_KEY in .env is being read by the container
404baseURL should be https://n.tokeness.dev/v1
Model dropdown is emptySet models.fetch: false and enter model names manually
Conversation title generation failsCheck that titleModel is an available model
Multiple users' keys get mixed upUse user_provided so each user enters their own key in the UI

References

OpenAI-compatible access with centralized models, quota, and logs.