LogoToRouter Docs
LogoToRouter Docs
HomepageWhat is ToRouter5-minute quickstartCore concepts
OpenAI Python SDKOpenAI Node / TypeScript SDKAnthropic SDK (Python & TypeScript)Google Gen AI SDK (Gemini)CursorCline (VS Code extension)Claude Code CLILangChain & LlamaIndexDify & n8n (no-code)
Integrations

Dify & n8n (no-code)

Wire Dify workflows and n8n automations to ToRouter via their OpenAI-compatible provider slots.

Both Dify and n8n ship an "OpenAI-compatible" provider that takes a custom base URL — point it at ToRouter and any model in the catalog becomes available inside your workflows and nodes.

Configuration

FieldValue
API endpoint / Base URLhttps://portal.torouter.ai/v1
API keysk-***
Model namegpt-5, claude-opus-4-7, gemini-2.5-pro, ...

Dify

Open model providers

In Dify go to Settings → Model Provider (top-right avatar → Settings).

Add OpenAI-API-compatible

Find OpenAI-API-compatible in the provider list and click Setup.

Fill in ToRouter

  • Model Name: paste a model id from the catalog, e.g. claude-opus-4-7
  • API Key: sk-***
  • API endpoint URL: https://portal.torouter.ai/v1
  • Completion mode: Chat
  • Leave other fields at defaults

Click Save. Dify validates by issuing a small completion.

Use in workflows

Open any LLM node in a workflow / chatflow — the model you just added appears in the model picker.

n8n

Drop an OpenAI Chat Model node

In your n8n workflow add a OpenAI Chat Model node (under AI / LangChain nodes).

Create new credentials

Click Credentials → Create New. Choose OpenAI API.

  • API Key: sk-***
  • Base URL: https://portal.torouter.ai/v1

Save.

Pick a model

In the node's Model field type the model id (e.g. gpt-5). The dropdown won't auto-populate model lists for custom base URLs, so type it manually.

Gotchas

  • In Dify, Model Name has to be added per model — each entry creates one usable slot. Re-open the provider config to add more.
  • Dify caches model capability info on save; if a new model type errors out, re-save with the right Completion mode (Chat vs Completion).
  • n8n stores credentials per-workflow scope. If you have multiple environments, create separate credentials so prod / dev keys don't mix.
  • Both tools default to OpenAI tool-calling schema. When using Claude models for tool-using nodes, validate that your function schemas don't rely on OpenAI-only fields.

Next steps

Create an API key

Base URL & auth reference

Model catalog

Troubleshoot errors

LangChain & LlamaIndex

Use LangChain's ChatOpenAI and LlamaIndex's OpenAI wrapper against ToRouter to mix Claude, GPT and Gemini in one chain.

Common HTTP errors

Quick reference for 400 / 401 / 403 / 404 / 429 / 5xx responses from ToRouter and how to fix them.

Table of Contents

ConfigurationDifyOpen model providersAdd OpenAI-API-compatibleFill in ToRouterUse in workflowsn8nDrop an OpenAI Chat Model nodeCreate new credentialsPick a modelNext steps