Published
How to connect AI models to n8n via an OpenAI-compatible Base URL
Every AI workflow in n8n — from support ticket triage to a Tools Agent calling your CRM — runs through the OpenAI Chat Model sub-node. Pointing its OpenAI API credential at an OpenAI-compatible Base URL lets one key drive 15 model series across 7 vendors without juggling separate billing accounts.
Step 1 — right on this page
Issue a Base URL and API key for n8n
Click below to mint your config-id and sk-... key, then send a test completion before pasting them into n8n.
Press it and get your base_url and API key.
No sign-up, no card.
Free. Your key appears right here.
Exact fields to set in n8n
- OpenAI Credentials → Base URL:
https://twelver.app/api/ai/<config-id>/v1(set on the credential, not on the node). - OpenAI Chat Model → Model: switch the selector from List to By ID and enter a series such as
auto,deepseek-flash, orgpt. - Use Responses API: toggle Off — the gateway serves
/v1/chat/completions.
How n8n wires Webhook, AI Agent, and OpenAI Chat Model
In current n8n releases, the AI Agent node delegates model calls to its attached OpenAI Chat Model sub-node, which reads Base URL and API Key from your OpenAI API Credentials.
Interactive n8n node builder
Pick a workflow task below to get the recommended series, live rail pricing, exact n8n fields, and a copyable cURL or JSON test payload.
n8n Node Builder
Configure OpenAI Chat Model for your workflow
Pick a workflow pattern to get the recommended model series, live rate, exact OpenAI Credential fields, and a copyable test request.
Fast, low-cost series for high-volume ticket triage and routing.
- Base URL
- https://twelver.app/api/ai/<config-id>/v1
- API Key
- sk-<your-key>
- Recommended series:
- deepseek-flash (DeepSeek V4.1 Flash)
- Rate ($ per 1M):
- 0.488 / 1.95
- Model:
- By ID
- Use Responses API:
- Off (required)
- Node / Chain:
- Basic LLM Chain / AI Agent
- Parameters:
- response_format: { type: "json_object" }
curl -X POST "https://twelver.app/api/ai/<config-id>/v1/chat/completions" \
-H "Authorization: Bearer sk-<your-key>" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-flash",
"temperature": 0.1,
"messages": [
{
"role": "system",
"content": "Classify the support ticket. Return JSON: {\"category\":\"billing|bug|howto\",\"priority\":\"low|high\"}."
},
{
"role": "user",
"content": "I did not receive an invoice after paying for my plan."
}
],
"response_format": {
"type": "json_object"
}
}'Step-by-step setup in the n8n UI
- Create an OpenAI API credential: inside
OpenAI Chat Model, open Credential to connect with → Create New Credential. Paste yoursk-...key into API Key andhttps://twelver.app/api/ai/<config-id>/v1into Base URL. - Set Model to By ID: switch the
Modeldropdown from From List to By ID and type a valid series (auto,deepseek-flash,deepseek,gpt). Leaving a default list ID such asgpt-4oreturns404 model_not_found. - Turn Use Responses API Off: in
OpenAI Chat Modeloptions, set Use Responses API to Off so n8n posts to/v1/chat/completionsinstead of/v1/responses. - Attach Tools and Structured Output Parser:
tools,tool_choice,parallel_tool_calls,response_format, and SSE streaming all work natively.
Model series and rates for n8n workflows
One key unlocks 15 series across 7 vendors (GPT, DeepSeek, Qwen, Grok, GLM, MiMo, MiniMax). Note that Claude and Gemini are not served on this endpoint. New accounts start with 250,000 tokens with no card required.
| Series (By ID) | Model | In / Out ($ per 1M) | Best fit in n8n |
|---|---|---|---|
| deepseek-flash | DeepSeek V4.1 Flash | 0.488 / 1.95 | High-volume ticket classification and routing |
| gpt | GPT-6 Luna | 0.163 / 0.813 | Lowest input rate for fast short replies |
| auto | Qwen3.7-Plus | 0.65 / 2.6 | Balanced default for JSON Extractor and AI Agent |
| deepseek | DeepSeek V4 Pro | 2.15 / 6.44 | Multi-step Tools Agent and document analysis |
| gpt-terra | GPT-6.1 Terra | 1.63 / 8.13 | Strict instructions; requires reasoning_effort: none with temperature |
| qwen-max | Qwen4-Max | 2.44 / 7.31 | Large context and complex table extraction |
| grok | Grok 4.7 | 3.25 / 9.75 | Long reasoning chains and copy generation |
| zai | GLM-5.3 | 2.28 / 7.15 | Alternative for multi-step workflows |
| minimax | MiniMax M3.1 Flash | 0.244 / 0.975 | Fast drafts and batch processing |
Estimating AI Agent loop costs
A single Tools Agent run typically triggers 2 to 5 LLM turns, resending the system prompt and tool JSON schemas on each step. Check your monthly run cost before going live:
Work out what the requests cost
Pick a workload or type your own numbers — the calculator multiplies them by each series’ rates. A token is roughly 4 characters of English text or code.
deepseek-flashDeepSeek V4.1 Flash$16.59 per monthgptGPT-6 Luna$5.7 per monthautoQwen3.7-Plus$22.1 per monthdeepseekDeepSeek V4 Pro$70.94 per monthgpt-terraGPT-6.1 Terra$57.03 per monthTwelver rates as of 1 December 2026; tokens are billed as actually used, caching and discounts not included. The arithmetic runs in your browser.
Fixing common n8n errors
| Error | Cause in n8n | Fix |
|---|---|---|
| 404 Not Found | Use Responses API is On, or /v1 is missing from Base URL | Set Use Responses API = Off and verify .../api/ai/<config-id>/v1 |
| 404 model_not_found | Model dropdown still sends gpt-4o or another unmapped name | Switch Model to By ID and enter auto, deepseek-flash, or gpt |
| 400 Bad Request (temperature) | temperature sent to gpt-terra, gpt-sol, or gpt-max without reasoning_effort: none | Remove temperature, pass reasoning_effort: "none", or use auto / deepseek |
| 402 insufficient_quota | Starter 250,000 tokens or balance exhausted | Top up via the /upgrade link returned in the error payload |
Need a hand
Generate your n8n config in chat
Opens chat with a ready draft: the API integrator will issue your Base URL and key, pick a series for your Tools Agent, and debug errors.
Next steps
Full book: API for AI agents. Related guides: DeepSeek API, ChatGPT API, OpenCode. Pricing and full series table: Twelver Coding API.
Frequently asked questions
Which Base URL should I set in n8n OpenAI Credentials?
Why does n8n return 404 with a custom OpenAI-compatible API?
Do Tools Agent and Structured Output Parser work?
Which models are available through one Twelver key in n8n?
How much does an n8n AI Agent run cost?
Try it yourself
Everything in this guide runs inside Twelver
One chat for text, images, video, music and voice — no separate services or subscriptions.
Open Twelver chat