Use TokenRex with Dify
Build Dify agents and chatbots with TokenRex through the OpenAI-API-compatible model plugin.
Choose a model with tool calling when building an Agent app. Set any required context and output limits from the selected model's verified details. Chat-model setup does not configure embeddings or document retrieval. 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 Dify workspace with model-provider settings access
- OpenAI-API-compatible plugin
- A TokenRex API key
Setup methods
Provider setup
- 1
Open your Dify workspace, or self-host using https://docs.dify.ai/en/self-host/deploy/quick-start/docker-compose.
- 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
With workspace owner or administrator access, install Dify's OpenAI-API-compatible plugin. Open Integrations → Model Provider (Settings → Model Provider in older releases) and add a model under that plugin.

Official Dify model configuration controls, not the TokenRex compatible-plugin form. Official source - 1Configure models under the correct installed provider plugin.
- 2Use the OpenAI-API-compatible plugin and the next step's values.
- 4
Set the model type to LLM, Model Name to gpt-6-astra, API Base URL to https://tokenrex.ai/api/public/v1, API Key to your private TokenRex key, and Completion mode to Chat.
- 5
If prompted for context size, maximum output or tool-calling capabilities, use the selected model's verified details rather than a guessed value. Save and validate the provider credentials.
- 6
Create a Chatbot, Agent or Workflow app, choose the configured TokenRex model for its LLM step and send a test message in Preview. Connect and publish channels only after testing.
Provider: OpenAI-compatible
API base URL: https://tokenrex.ai/api/public/v1
API key: <your TokenRex API key>
Model ID: gpt-6-astra
API mode: Chat CompletionsTroubleshooting
- 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.