n8n AI workflow with an OpenAI-compatible API: credentials step by step
n8n lets you chain an AI model into any automation: a webhook that summarizes an email, a cron job that drafts a report, a form that classifies support tickets. The AI part needs an OpenAI-compatible credential pointing at a model provider. This guide wires n8n to apillms so you can use Claude, GPT, DeepSeek, Grok or Kimi models in any workflow, then shows where to check what it cost you.
What you need
- An apillms account (sign-up gives you 50 free credits) and your API key from the Keys page.
- A running n8n instance (cloud or self-hosted).
The full step list with screenshots is at /integrations?app=n8n. This post walks through the same steps with explanation.
Step 1: get your key
Log in at /login and open API keys. Click Show key to copy it. Each account has exactly one key — there's no "create new key" button, only Show and Roll (Roll disables the old key and issues a new one, useful if a key leaks).
Note the OpenAI-compatible base URL on the same page: https://apillms.com/v1. n8n's AI nodes speak the OpenAI API format, so this is the one you'll use.
Step 2: create the credential in n8n
In n8n, add a new credential of type OpenAI (this is the generic OpenAI-compatible credential type, not tied to OpenAI specifically). Fill it in like this:
API Key: <your apillms key>
Base URL: https://apillms.com/v1
Save it. n8n will route every request from this credential through apillms instead of OpenAI's own servers.
Step 3: add a chat model node
Drop an OpenAI Chat Model node (or the AI node you're using, such as a LangChain Chat Model node) into your workflow and select the credential you just created. In the model field, type the model id you want — for example claude-sonnet-5, gpt-5.5, or deepseek-v4-flash. The full id list is on the Models page, where you can also filter by capability.
A minimal test workflow looks like this:
Manual Trigger -> Set (prompt text) -> OpenAI Chat Model -> NoOp (view output)
Set a simple system prompt and a user message, run the workflow once, and check the output panel on the chat model node.
Step 4: test the connection
Before building a full workflow, it helps to confirm the key and base URL work outside n8n. A quick cURL check:
curl https://apillms.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-5","messages":[{"role":"user","content":"ping"}]}'
If that returns a response, your credential in n8n will work the same way. You can also test the key from the Connect page in the console, which opens app-specific guides and lets you verify the key before touching n8n.
If you want to try prompts interactively first, the Playground (also in the console) lets you pick a model, set temperature and max output tokens, and has a Code button that generates the request snippet — handy for copying into an n8n HTTP Request node if you'd rather not use the OpenAI node type.
Step 5: pick a model for the job
Different nodes in a pipeline don't need the same model. A classification step that runs on every incoming row benefits from a cheap, fast model; a final summarization or drafting step can use a stronger one. Example apillms prices per 1M tokens:
| Model | Input | Output | Cache read |
|---|---|---|---|
| claude-sonnet-5 | $0.274 | $1.37 | $0.046 |
| gpt-5.5 | $0.532 | $3.19 | $0.03 |
| deepseek-v4-flash | $0.047 | $0.047 | $0.027 |
For a typical short chat-style call (1,000 input + 500 output tokens), 1,000 of those calls cost $2.24 on claude-sonnet-5, $0.319 on gpt-5.5, or $0.14 on deepseek-v4-flash. If your n8n workflow runs on a schedule hundreds of times a day, the model you pick in the chat node has a direct effect on your monthly bill. See /compare for a live side-by-side against OpenRouter pricing.
Step 6: track cost on the Usage page
Once the workflow is live, open the Usage page in the console. It shows spend for today, the last 7 days, and the last 30 days, broken down by product, with filters by type and status and a CSV export. If a node in your workflow fails (bad model id, malformed request), that call isn't billed — apillms only charges for completed requests.
If you're running several workflows against the same key, the Overview page gives a quick glance at balance and spend today without digging into the detailed Usage filters.
Scaling up
Credits never expire, so there's no rush to "use them up." If a workflow runs heavily in production, a larger pack brings more credits per dollar at the higher tiers — compare them on /pricing, which also shows per-pack token estimates for popular models. Payment is by PayPal or card on the Billing page.
If you refer other developers to apillms, the affiliate program pays 20% of their purchases for life — your link is on the Affiliate page.
Takeaway
n8n treats apillms like any OpenAI-compatible provider: one credential with your key and the https://apillms.com/v1 base URL, then pick any model id in the chat node. Test with a manual trigger before wiring it into a real pipeline, and keep an eye on the Usage page so model choice doesn't quietly inflate your bill.
Try apillms
One API key for Claude, GPT, Grok, DeepSeek and Kimi. OpenAI- and Anthropic-compatible, prompt caching included, pay-as-you-go from $5 with PayPal or card. Credits never expire.
FAQ
Which n8n credential type should I use for apillms?
Use the standard OpenAI credential type in n8n and set its Base URL to https://apillms.com/v1 with your apillms key as the API key.
Can I use Claude models through the OpenAI node in n8n?
Yes. Since apillms exposes an OpenAI-compatible endpoint, you can type any supported model id, including Claude models like claude-sonnet-5, into the OpenAI Chat Model node.
How do I check how much my n8n workflow is costing?
Open the Usage page in the apillms console; it shows spend by day range and by product, with CSV export and filters by type and status.
What happens if a node in my workflow fails mid-call?
Failed requests aren't billed, so a malformed request or an error from the model provider doesn't consume credits.