Connecting Claude/OpenAI: Credentials, Model Selection, Cost Control

How to set up Anthropic and OpenAI credentials in n8n, choose the right model for each task, and keep token costs under control.

Anyone working with Anthropic's (Claude) or OpenAI's AI nodes in n8n first sets up a credential with an API key, then selects a model in the respective chat model node, and controls how expensive and how capable a single workflow run becomes through node options such as the maximum number of tokens. Both providers offer several model tiers that differ in speed, price per million tokens, and capabilities, so cheaper models are suitable for simple tasks like classification or text snippets, while more capable models make sense for complex steps such as multi-step agentic behavior or deep reasoning. As of: July 2026.

Setting Up Anthropic and OpenAI Credentials in n8n

For the Anthropic credential, you need an account in the Anthropic Console with access to Claude. There, under Settings > API Keys, you create a new key, give it a descriptive name such as "n8n-integration", and copy the value into the API Key field of the n8n credential. Optionally, a custom header can be added. n8n documents the exact steps in the Anthropic Credential Reference. This credential authenticates both the Anthropic node and the Anthropic Chat Model node.

For OpenAI, create a new secret key in the OpenAI account under API Keys and enter it as the API key in n8n as well. An organization ID is only needed if you belong to multiple organizations; if it is set, usage runs against that organization's quota instead of your personal account. n8n describes the details in the OpenAI Credential Reference. The OpenAI credential covers several nodes: the OpenAI node, Chat OpenAI, Embeddings OpenAI, and LM OpenAI.

Choosing a Model by Task in the Workflow

With Claude Haiku 4.5, Claude Sonnet 5, Claude Opus 4.8, and Claude Fable 5, Anthropic offers several current model tiers, and OpenAI offers comparable tiers with GPT-5.6 Luna, GPT-5.6 Terra, and GPT-5.6 Sol. In both cases: fast, inexpensive models like Claude Haiku or GPT-5.6 Luna are suitable for high-volume, simple tasks in a workflow, such as classifying incoming emails, extracting fields from structured texts, or short summaries. Balanced models like Claude Sonnet 5 or GPT-5.6 Terra combine speed and contextual understanding and fit most automation steps that need somewhat more judgment. The most capable tiers, Claude Opus 4.8 and Fable 5 respectively, as well as GPT-5.6 Sol, are, according to the manufacturers, intended for complex, multi-step agentic behavior, extensive reasoning, or demanding coding tasks. Which tier fits in a given case depends on the respective workflow step, not on a general ranking of the models. In the Anthropic Chat Model node, you select the model directly; since model names change regularly with both providers, it is worth checking the provider's current model overview before going into production. The OpenAI Chat Model node loads the models dynamically from your account and shows only the options enabled for you.

Cost Control via Token Limits and Usage Monitoring

The most important lever directly in the workflow is the Maximum Number of Tokens node option, which limits the length of the model's response and thus the output costs, since output tokens cost significantly more than input tokens with both providers. According to the current Anthropic pricing overview, the output price per model is five times the input price; for the current GPT-5.6 models, according to the OpenAI pricing page, it is roughly six times. For recurring workflows with unchanging system prompts, prompt caching is worthwhile: Anthropic offers reduced read prices for cached prompt portions, while OpenAI provides the Prompt Cache Key option for this in the Responses API mode of the OpenAI Chat Model node. For non-time-critical batch processing, both providers reduce costs via their own batch APIs by roughly half compared to standard prices.

Actual cost control does not take place in n8n itself, but in the providers' consoles: both the Anthropic Console and the OpenAI dashboard show usage per period and allow setting spending limits or alerts. This is important because a faulty workflow, such as a loop without a termination condition, can cause substantial costs in a short time without n8n itself warning about it. It therefore makes sense to set a token limit in every production workflow, to use the most expensive model only where the task genuinely requires it, and to regularly check usage in the respective provider console instead of relying solely on the bill at the end of the month.

Anyone combining multiple AI providers in a workflow, or unsure which model tier makes economic sense for which step, can roughly estimate the effort with an ROI Calculator or get support in the design of AI Agents. NordFlux typically implements such integrations at a fixed price, including documentation of the chosen model and cost logic.

Frequently Asked Questions about Claude and OpenAI in n8n

Do I need different credentials for Claude and OpenAI in n8n?

Yes. Both providers use their own API keys and their own credential types in n8n. The Anthropic credential authenticates the Anthropic node and the Anthropic Chat Model node, while the OpenAI credential covers the OpenAI node, Chat OpenAI, Embeddings OpenAI, and LM OpenAI.

Which model is sufficient for simple automation tasks?

For classification, extraction, or short text snippets, the fastest and cheapest model tiers, such as Claude Haiku 4.5 or GPT-5.6 Luna, are usually sufficient. More complex steps involving multi-step reasoning benefit more from Sonnet 5, Opus 4.8, GPT-5.6 Terra, or Sol.

How do I prevent a workflow from causing unexpectedly high API costs?

Set a token limit in the respective chat model node option, avoid unchecked loops, and regularly check usage in the provider's dashboard. Spending limits or alerts can be configured directly there, not in n8n itself.

Can I combine Anthropic and OpenAI in the same workflow?

Yes, n8n allows you to use multiple chat model nodes with different credentials in one workflow, for example an inexpensive model for preprocessing and a more capable model for the decisive step.

About NordFlux

NordFlux UG (haftungsbeschränkt)

NordFlux builds digital employees for organisations: automations and AI agents that take over repetitive work. You stay in control.

More about us
Free initial analysis

Concrete questions about automation or AI?

In a free initial analysis we discuss your case directly. No strings attached.