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 openai/gpt-6-astra; replace it with your selected ID.
- 3.
Install the OpenAI-API-compatible model plugin from Dify's marketplace. Open Settings → Model Provider and add a model under that plugin.
- 4.
Set the model type to LLM, Model Name to openai/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: openai/gpt-6-astra
API mode: Chat CompletionsVerify 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.