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
Provider setup
- 1.
Install LibreChat following https://www.librechat.ai/docs/local/docker or its official local setup guide.
- 2.
Create a TokenRex API key, then copy an enabled chat model's exact ID from Models & Pricing. The examples use openai/gpt-6-astra; replace it with your selected ID.
- 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.
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.
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.
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.
# Merge into librechat.yaml
endpoints:
custom:
- name: TokenRex
apiKey: '${TOKENREX_API_KEY}'
baseURL: 'https://tokenrex.ai/api/public/v1'
models:
default: ['openai/gpt-6-astra']
fetch: false
# Private .env file (not inside librechat.yaml):
# TOKENREX_API_KEY=<your TokenRex API key>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.