
n8n
Fair-code workflow automation with native AI nodes and 400+ integrations
Introduction
n8n is a workflow automation platform with first-class AI support. Its OpenAI integration accepts a custom Base URL, which means you can point it at TokenMix's OpenAI-compatible endpoint and use any TokenMix model inside n8n's AI nodes — without any code changes.
Prerequisites
Self-host n8n with Docker (recommended):
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
docker.n8n.io/n8nio/n8n
Access n8n at http://localhost:5678 and complete the initial setup.
You also need a TokenMix API key. Sign up at tokenmix.ai → Console → API Keys and create a new key.
Setup Steps
Step 1 — Open Credentials
In the n8n sidebar, click Credentials → Add Credential → search for OpenAI.
Step 2 — Fill in the OpenAI credential
| Field | Value |
|---|---|
| API Key | Your TokenMix key (sk-tm-…) |
| Base URL | https://api.tokenmix.ai/v1 |
| Organization ID | (leave blank) |
Click Save. n8n will test the credential automatically.
Step 3 — Use the credential in an AI node
In your workflow, add an AI Agent, LLM Chain, or any OpenAI-powered node. In the node settings, select the credential you just created, then pick your model (e.g. gpt-5.4, claude-sonnet-4.6, deepseek-v4-pro).
Step 4 — Run and verify
Execute the workflow. Check the node output for a valid response. You can also confirm in TokenMix Console → Usage that the request was logged.
Verify
Trigger a manual run with the Test Workflow button. A successful node output means TokenMix is routing the request correctly.
FAQ
Q: The OpenAI node returns a 404 "model not found" error.
A: Verify the model name exactly matches the short_id shown on the TokenMix Models page (e.g. gpt-5.4 not gpt-5). n8n v2 AI nodes use the model name directly from the credential or node settings.
Q: I'm on an older n8n version and the OpenAI Base URL field is missing.
A: Update n8n to the latest version. Alternatively, use the HTTP Request node to call https://api.tokenmix.ai/v1/chat/completions directly with a Bearer token header — this works on any n8n version.
Q: Can I use different models in different workflows? A: Yes. Create one credential per model (each with the same Base URL and API key, different model name in node settings), or simply select different model names in each node — the Base URL credential is shared.