LibreChat logo
Chat apps

Use TokenRex with LibreChat

Add a TokenRex endpoint to LibreChat for custom-model chats and compatible agent workflows.

Merge the custom endpoint into your existing YAML rather than replacing other endpoints. Keep the key in the private environment file. Additional agent tools and retrieval need their own setup and compatible models. Provider setup checked against the official reference. Live execution inside this third-party tool has not been tested; model limits, streaming and tool behavior must be verified separately.

Before you start

  • A LibreChat installation you can configure
  • Access to librechat.yaml and the private .env file
  • A TokenRex API key

Setup methods

01

Provider setup

  1. 1

    Install LibreChat following https://www.librechat.ai/docs/local/docker or its official local setup guide.

  2. 2

    Create a TokenRex API key, then copy an enabled chat model's exact ID from Models & Pricing. The examples use gpt-6-astra; replace it with your selected ID.

  3. 3

    Add TOKENREX_API_KEY with your real key to LibreChat's private .env file. Keep it out of source control and shared configuration exports.

  4. 4

    Merge the endpoints.custom entry below into librechat.yaml. baseURL is https://tokenrex.ai/api/public/v1; fetch: false uses your explicit model list without requiring model discovery. Preserve the file's existing version and other settings.

  5. 5

    For Docker, mount librechat.yaml into the API container following the official custom-endpoints guide and recreate/restart the service after saving. For a local installation, restart the app.

  6. 6

    Open LibreChat, select TokenRex as the endpoint, choose your exact model and send a short message. Configure any agent actions separately after chat is working.

Configuration
# Merge into librechat.yaml
endpoints:
  custom:
    - name: TokenRex
      apiKey: '${TOKENREX_API_KEY}'
      baseURL: 'https://tokenrex.ai/api/public/v1'
      models:
        default: ['gpt-6-astra']
        fetch: false

# Private .env file (not inside librechat.yaml):
# TOKENREX_API_KEY=<your TokenRex API key>

Setup reference

Troubleshooting

Authentication fails
Check that the saved TokenRex key is active and belongs in the tool's API-key field, not its subscription sign-in. Remove accidental spaces, check your wallet balance, and never share the key in screenshots or exported settings.
The model is missing or the request URL returns 404
Copy an exact enabled model ID from Models & Pricing. Follow this method's URL field: some tools expect the versioned base, others the root or full completion address. Check the documented API protocol before changing the path.
Chat works but streaming or tools fail
Test a short plain-text conversation first. Confirm the selected model and installed tool version support the required protocol and capabilities. Enable agent actions only after separately checking streaming and tool calls.

Verify the connection

Send a short message with the selected model, read its response, then confirm the exact model appears in your TokenRex usage. Test streaming and tool use separately before larger agent tasks.