n8nIntegrationAutomation

n8n with Claude and GPT: Custom API Base URL Setup

(prices in the text follow the live price list)

Short answer

To use n8n with APIVAI, create an OpenAI credential in n8n, paste your APIVAI key into API Key and change Base URL to https://api.apivai.com/v1, then connect an OpenAI Chat Model node to your AI Agent and set the model to an ID such as claude-sonnet-4-6 or gpt-5.5. For Claude models you can use the Anthropic credential instead, with Base URL https://api.apivai.com and no /v1, because n8n adds /v1/messages to that address itself. The same key works in both credentials and for every model. As of 2026-10-07, Claude Sonnet 4.6 costs $1.04 / $5.22 per million input / output tokens through APIVAI, against the official $3.00 / $15.00.

What is n8n, and where does the model come in?

n8n is a workflow automation tool you can self-host or use as n8n Cloud. Its AI features are built from root nodes such as AI Agent and Basic LLM Chain. Each of them has a Chat Model connector, and the chat model sub-node you attach there decides which API is called.

The chat model node takes its address and key from a credential. In current n8n (checked against the n8n source and docs in October 2026), both the OpenAI credential and the Anthropic credential have a Base URL field. That is all you need: no community node and no HTTP Request workarounds. Every workflow that uses the credential then runs on your APIVAI balance, billed per token. If you also build chat apps in Dify, the same key works there: see Dify with Claude and GPT.

Which credential should you use: OpenAI or Anthropic?

OptionBase URLModelsPick it when
OpenAI credential + OpenAI Chat Model nodehttps://api.apivai.com/v1Claude and GPTYou want one credential for everything and to switch models by changing one field
Anthropic credential + Anthropic Chat Model nodehttps://api.apivai.comClaude onlyYou only use Claude and want the native format, with the node's Prompt Caching and Thinking Mode options

Most people should start with the OpenAI credential. Add the Anthropic one later if you run Claude workflows with long, repeated system prompts, where prompt caching lowers the input cost. The general details of both formats are on the OpenAI-compatible API and Claude API proxy pages.

How do you set up n8n with APIVAI step by step?

Step 1: Get an API key

  1. Sign up with your email
  2. Top up your balance, from $10, by card, crypto, Alipay or WeChat Pay
  3. Create a key on the Dashboard and copy it. You can give the key its own budget limit, which is useful for automations that run unattended.

Step 2: Create the OpenAI credential

  1. Open a workflow and add an AI Agent node (or a Basic LLM Chain).
  2. Click + under Chat Model and choose OpenAI Chat Model.
  3. In Credential to connect with, choose Create new credential.
  4. Fill in the fields:
FieldValue
API Keyyour APIVAI key
Organization ID (optional)leave empty
Base URLhttps://api.apivai.com/v1
  1. Click Save. n8n tests the credential by requesting /models from the Base URL. If the test passes, the key and the address are both right.

Step 3: Configure the OpenAI Chat Model node

  • Model: open the list and pick a model. n8n loads the list from APIVAI, so you see the IDs your key can use. You can also switch the field from From List to ID and type an ID such as claude-sonnet-4-6.
  • Use Responses API: recent versions of the node turn this on by default. APIVAI supports the Responses API, so you can leave it on for GPT models. For Claude models, turn it off so the node uses Chat Completions. Leave Built-in Tools empty and give the agent n8n tool nodes instead.
  • Options → Maximum Number of Tokens: if you set a limit, use 4096 or more. Thinking is on by default and counts toward output, so a small limit can return an empty or cut-off answer.

Alternative: the Anthropic credential for Claude

  1. Under Chat Model, choose Anthropic Chat Model and create a new credential.
  2. Set API Key to your APIVAI key and Base URL to:
https://api.apivai.com

Do not add /v1. n8n's credential test calls /v1/models and the node sends requests to /v1/messages, both appended to this address.

  1. In the node, pick the model from the list or switch to ID and enter it.
  2. Under Options, keep Maximum Number of Tokens at 4096 or more. Use Prompt Caching (5 Minutes or 1 Hour) when a workflow sends the same long system prompt many times; cached input is read at $0.10 per 1M tokens for Claude Sonnet 4.6 as of 2026-10-07. Leave Thinking Mode unset to keep the model default.

Step 4: Test the workflow

Add a When chat message received trigger in front of the agent, open the chat panel and send a short message. When the agent answers, the request appears with its tokens and cost on your APIVAI Dashboard.

Which model should you choose for n8n workflows?

Prices per 1M input / output tokens as of 2026-10-07:

ModelAPIVAIOfficialGood for
Claude Haiku 4.5$0.35 / $1.74$1.00 / $5.00Classifying, extracting fields, short summaries at volume
Claude Sonnet 4.6$1.04 / $5.22$3.00 / $15.00Default for agents with tools
Claude Sonnet 5.5$0.69 / $3.47$2.00 / $10.00Agents with many steps, writing
Claude Opus 5.5$1.39 / $6.96$4.00 / $20.00The hardest reasoning tasks
GPT-5.5$0.77 / $4.56$5.00 / $30.00GPT alternative for agents
GPT-6 Sol$0.30 / $1.52$2.00 / $10.00Newer GPT for complex flows
GPT-6 Luna$0.0144 / $0.0768$0.10 / $0.50Cheapest option for simple steps

A practical pattern: run cheap steps such as routing, tagging and extraction on Claude Haiku 4.5 or GPT-6 Luna, and give only the agent that has to plan and call tools a Sonnet model. Each node can use a different model with the same credential.

The model list changes over time. Pick IDs from the pricing page or ask the API directly:

curl https://api.apivai.com/v1/models -H "Authorization: Bearer YOUR_KEY"

What does an n8n workflow cost with APIVAI?

Automations are easy to estimate because they run the same prompt shape again and again. Two examples, with thinking tokens counted as output:

  • Email triage: a workflow classifies 200 incoming emails a day with Claude Haiku 4.5, about 2,000 input and 500 output tokens each. A month of 6,000 requests costs $9.42, against $27.00 at official prices.
  • Support agent: an AI Agent on Claude Sonnet 4.6 answers 50 tickets a day and makes about 5 model calls per ticket (tool calls included), each around 6,000 input and 800 output tokens. That is 7,500 calls a month: $78.12, against $225 at official prices.

Agents cost more than single calls because each step resends the conversation and tool results. Watch the Dashboard for a day, then adjust the model per node. A wider price comparison is in Claude API pricing in 2026.

Can you use APIVAI for n8n vector stores and RAG?

Only for the chat part. APIVAI does not provide embeddings, so the Embeddings sub-node of a vector store needs a separate embedding provider. The agent that answers from the retrieved text can still use an APIVAI chat model.

Troubleshooting

  • Credential test fails or 401: check that the key was copied in full, still exists, and has balance or budget left. In the Anthropic credential, make sure the key is in API Key and nothing else.
  • 404: the /v1 is wrong. The OpenAI credential needs https://api.apivai.com/v1 exactly, with /v1 once. The Anthropic credential needs https://api.apivai.com with no /v1; with /v1 the requests go to /v1/v1/messages.
  • Model not found: n8n reports that the model was not found at your Base URL. Use the exact ID, such as claude-sonnet-4-6, not a display name, and take it from /v1/models.
  • Empty or cut-off answers: raise Maximum Number of Tokens to 4096 or more; thinking tokens use part of the limit.
  • Errors with a Claude agent on the OpenAI credential: turn off Use Responses API in the OpenAI Chat Model node and try again.
  • 429 Too Many Requests: the default limit is 60 requests per minute per key. Process items in smaller batches, set Max Retries in the node options or Retry On Fail in the node settings, or ask support to raise the limit.

FAQ

Do I need a community node to use APIVAI in n8n?

No. The built-in OpenAI and Anthropic credentials both have a Base URL field, so the standard chat model nodes work.

Does this work on self-hosted n8n and n8n Cloud?

Yes, the credential fields are the same. A self-hosted instance needs outbound internet access to api.apivai.com.

Can one key serve both Claude and GPT nodes?

Yes. One APIVAI key works for all models, in the OpenAI credential and in the Anthropic credential.

How do I cap what an automation can spend?

Create a separate key for n8n and give it a budget limit on the Dashboard. When the budget is used up, requests with that key stop instead of draining your balance. The docs explain keys and limits.

Does APIVAI store the data my workflows send?

Request and response content is not logged. Only usage data such as model, tokens and cost is kept for billing.

Create an account, top up from $10 and paste your key into n8n.

Ready to start?

Get your API key in 30 seconds. Pay as you go for Claude and GPT.