Skip to content

Connect n8n to Claude and GPT via API, step by step

Set up n8n's OpenAI and Anthropic credentials with our base URL, choose the model by ID, build an AI Agent workflow and see what each run costs.

Updated November 3, 2026Markdown version

n8n's OpenAI and Anthropic credentials both have a Base URL field. To run your workflows on 5abeer, put our base URL there, paste a key for that provider and set the model by its ID. Then connect the chat model to an AI Agent node, and each call is paid per token from your 5abeer balance.

How does n8n connect to Claude and GPT?#

An AI workflow in n8n has a root node, such as AI Agent, and a chat model sub-node, such as OpenAI Chat Model or Anthropic Chat Model, that sends the requests. The chat model reads its address and key from a credential with a Base URL field, so you need no community node.

5abeer is OpenAI-compatible: change the base URL and keep your code. It is also compatible with the Anthropic Messages API, the format the Anthropic node sends. What is a base URL? explains the term.

Each key works with one provider's models, and all keys draw on one balance, as One key per provider explains.

What you need#

  • A 5abeer balance, topped up with one of the payment methods.
  • A key for each provider you will use, created as in Create a key.
  • n8n Cloud or self-hosted n8n. The AI nodes are built into both.

Every setting below matches n8n 2.45.7, the stable release when we checked on 2026-11-03. Labels can change in later releases. Each credential takes its own base URL:

n8n credentialn8n's default Base URLOur base URL
OpenAIhttps://api.openai.com/v1https://api.5abeer.ai/v1
Anthropichttps://api.anthropic.comhttps://api.5abeer.ai

The OpenAI URL keeps /v1. The Anthropic URL has none, because the node adds /v1/messages itself.

How to set up your first AI agent#

  1. Add a Chat Trigger#

    Add a Chat Trigger node to a new workflow. It appears as When chat message received and runs the workflow for each message you send in the chat panel.

  2. Add an AI Agent#

    Add an AI Agent node after the trigger and keep Source for Prompt (User Message) on Connected Chat Trigger Node.

  3. Attach a chat model#

    Click the agent's Chat Model connector and pick OpenAI Chat Model for GPT or Anthropic Chat Model for Claude.

  4. Send a test message#

    A reply means the credential, base URL and model ID all work. If a node turns red, open it, read the error and see the common errors below.

How to connect GPT models#

The newest GPT models, at our price per million tokens:

per 1M tokens

Official price from the provider's page, checked October 19, 2026.

All models and prices
  1. Create a key for GPT models#

    Create a key for the OpenAI provider, as in Create a key. Name it after the workflow, such as n8n-support, to find its usage easily.

  2. Create the OpenAI credential#

    In the OpenAI Chat Model node, create a new OpenAI credential. Paste your key in API Key, leave Organization ID (optional) empty and set Base URL to https://api.5abeer.ai/v1. On save, n8n tests the credential by asking that address for the model list.

  3. Set the model by ID#

    In Model, switch from From List to ID and paste a model ID from the table above, exactly as written. The full catalog is on the models page.

  4. Check two switches#

    Keep Use Responses API on, its default, since 5abeer serves GPT models in the Responses format. Leave Built-in Tools empty: its Web Search, File Search and Code Interpreter run on OpenAI's own platform, so give the agent tool nodes instead.

How to connect Claude models#

The newest Claude models, at our price per million tokens:

per 1M tokens

Official price from the provider's page, checked October 19, 2026.

All models and prices
  1. Create a key for Claude models#

    Create a second key, this time for the Anthropic provider. It draws on the same balance as your GPT key.

  2. Create the Anthropic credential#

    In the Anthropic Chat Model node, create a new Anthropic credential. Paste your Claude key in API Key and set Base URL to https://api.5abeer.ai. A URL ending in /v1 doubles the path, and every request fails.

  3. Set the model by ID#

    In Model, switch to ID and paste claude-sonnet-5.5, the default model, for most workflows. Use claude-opus-5.5 or claude-fable-5.1 for the hardest steps.

  4. Leave Options empty for the first run#

    Add no options until your first test gets a reply; the next section covers them.

Which node options matter on 5abeer?#

These entries in each node's Options list change what you get or pay on 5abeer:

NodeOptionWhat to do
OpenAI Chat ModelSampling Temperature, Top PSkip them: our Responses reference lists both as ignored for GPT models.
OpenAI Chat ModelConversation IDLeave it empty. Each request stands alone here, so keep the chat history with a memory node.
OpenAI Chat ModelPrompt Cache KeySet one fixed value per workflow, so its similar requests hit the same cache.
Anthropic Chat ModelSampling Temperature, Top K, Top PSkip them: n8n's hint says newer Claude models don't support them, so the node drops them.
Anthropic Chat ModelThinking ModeLeave it unset, so each model uses its default. For harder steps, choose Adaptive (Recommended) with an Effort of Low, Medium or High, the levels our Messages reference lists. Skip the legacy Manual (Deprecated).

Never set Thinking Mode to Disabled on claude-fable-5.1: Anthropic's migration guide, checked on 2026-11-03, says this model always thinks and rejects a request that turns thinking off. Thinking adds output tokens, so after you raise Effort, run one test and read its usage.

How to add memory, tools and a fallback model#

  • Memory: attach Simple Memory to the agent's Memory connector. Its Context Window Length, 5 by default, sets how many past exchanges go with each call, each billed again as input.
  • Tools: attach tool nodes, such as HTTP Request Tool or Call n8n Sub-Workflow Tool, to the Tool connector, and the agent calls them when needed. Claude and GPT both accept tools, as What each family supports shows.
  • Fallback model: turn on Enable Fallback Model in the agent and attach a chat model from the other provider, such as GPT behind Claude, to the new Fallback Model connector. The agent uses it when the main model fails.

For one prompt per item, such as tagging rows, use Basic LLM Chain with the same chat model.

What does an n8n agent cost?#

You pay per token from your balance. Input grows fastest in an agent: each call carries the system message, the remembered messages, the tool definitions and the new message, and one chat turn can take several calls when the agent uses tools.

For example, a support agent that sends ten million tokens a month and gets one million back, on the default model:

Example: what Claude Sonnet 5.5 costs

10M input tokens and 1M output tokens

Our price$9.0070% below the official price
Official price$30.00

Official price from the provider's page, checked October 19, 2026.

To keep the bill down:

  • Keep the system message short, attach only the tools the agent needs and keep Context Window Length low.
  • Use a cheaper model for simple steps.
  • Give each workflow its own key and read its usage, as in Track your usage.

Prompt caching and Cut your LLM API bill cover more ways to spend less. The official price of each model sits next to ours on the Claude API page and the OpenAI API page.

Common errors and fixes#

If the credential test fails on save, check the base URL first (/v1 for OpenAI, none for Anthropic), then the key. During a run:

  • INVALID_API_KEY: the key is wrong or incomplete. Paste it again.
  • MODEL_PLATFORM_NOT_ALLOWED: the key belongs to another provider, such as a GPT key in the Anthropic credential.
  • The model "…" was not found at …: the Anthropic node shows this when the address answers that the model doesn't exist. Paste the exact ID from the models page.
  • does not support disabling thinking: Thinking Mode is Disabled on a model that always thinks. Remove the option or choose Adaptive (Recommended).
  • INSUFFICIENT_BALANCE: your balance doesn't cover the request. Top up and retry.
  • API_KEY_QUOTA_EXHAUSTED: the key reached the spend limit you set on it.

Every code is explained in Errors and fixes.

FAQ#

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

Yes, the credentials and nodes are the same. On a self-hosted server with a fixed IP, you can also add that IP to the key's allow-list, as in Control every key.

Can I use Gemini models in n8n?#

Yes, through the OpenAI Chat Model node. Use a key for Gemini models in an OpenAI credential with our OpenAI-format URL, set the model by ID and turn Use Responses API off: our Responses format serves Claude and GPT only. Gemini model IDs and prices are on the Gemini API page.

Which model should an n8n agent start with?#

claude-sonnet-5.5, the default model, handles most agent work. Move a step to claude-opus-5.5 only when your tests show the default model gets it wrong.

How do I stop one workflow from overspending?#

Give the workflow its own key with a spend limit and an expiry date, as in Control every key. At the limit, its calls return API_KEY_QUOTA_EXHAUSTED, while your other keys keep working.

Who bills the model calls, n8n or 5abeer?#

With a 5abeer key, each model call is billed per token from your 5abeer balance, which you top up with any method in Payment methods. Running n8n itself, on n8n Cloud or on your own server, is a separate cost.

Is 5abeer part of n8n, OpenAI or Anthropic?#

No. 5abeer is an independent service, not affiliated with OpenAI, Anthropic or Google, and not part of n8n. It works in n8n because our API accepts the formats these nodes send.

Get started#

Top up your balance, create a key for each provider and paste it into the n8n credential. Every model and price is on the API page.