Want to test an n8n AI workflow with one controlled request? Create a BetterToken account and API key, then open the n8n setup guide and add an OpenAI credential. Build a Manual Trigger, AI Agent, and OpenAI Chat Model, limit Max Retries, and match the manual execution with the model, status, token usage, and cost in the BetterToken Dashboard.
What n8n does in this AI workflow
n8n controls the sequence of nodes and stores execution data. OpenAI Chat Model sends a request to the selected model, while BetterToken accepts the OpenAI-compatible API call. Three components are enough for the first test:
Manual Trigger → AI Agent
└─ OpenAI Chat Model
Manual Trigger prevents an accidental schedule or webhook run. AI Agent receives a fixed prompt, and Chat Model performs one model request. Do not add Telegram, email, database, publishing, or other nodes with external side effects.
In this setup, BetterToken provides the API key, Base URL, available Model ID, and usage records in Dashboard. It does not guarantee compatibility with every community node or OpenAI-hosted tool. Access to the BetterToken API endpoint from Russia does not require a VPN; availability of n8n Cloud, a self-hosted server, and third-party integrations must be checked separately.
Create a credential without exposing the API key
- Add an AI Agent node to the workflow.
- Add an OpenAI Chat Model sub-node through the Chat Model connector.
- Under Credential to connect with, select Create new credential → OpenAI.
- If the interface offers OpenAI Account (ChatGPT) and API Key, choose API Key.
Fill in the credential as follows:
- API Key: your BetterToken API key.
- Organization ID: leave empty.
- Base URL:
https://www.bettertoken.ai/v1. - Add Custom Header: disabled.
Store the credential in n8n's protected credential store. Do not put the key in a prompt, workflow JSON, Code node, screenshot, execution data, or repository.
Check current fields and authentication modes in the official n8n OpenAI credential documentation.
The Base URL must end in /v1. Do not append /models, /chat/completions, or /responses: n8n adds the required path. When the credential is saved, n8n checks models through /models relative to the configured Base URL.
If the Model list does not appear, reopen the credential and OpenAI Chat Model. Copy the exact Model ID from the current BetterToken documentation for n8n or the model plaza; this article does not pin a fast-changing ID.
Build a minimal AI workflow
1. Add Manual Trigger
Create a new workflow and add Manual Trigger. Keep the workflow unpublished while testing: n8n recommends manual executions when building and checking a workflow.
2. Configure AI Agent
Connect Manual Trigger to AI Agent. Choose an input mode that accepts a fixed prompt and use:
Return only JSON: {"workflow":"n8n","sum":4}. Do not call tools or perform external actions.
Do not connect Tool nodes. This test needs one model response, not an agent automation.
3. Connect OpenAI Chat Model
In the OpenAI Chat Model sub-node:
- choose the BetterToken credential you created;
- select the exact Model ID;
- disable Use Responses API for the first request and use Chat Completions;
- set a finite Timeout;
- set Max Retries to the lowest value allowed by your current n8n version.
The Model, Use Responses API, Timeout, and Max Retries settings are described on the official OpenAI Chat Model page.
Responses API and built-in Web Search, File Search, or Code Interpreter are outside this test. Seeing them in the n8n interface does not confirm support by the selected model or endpoint.
4. Run exactly one manual execution
Click Execute Workflow. A successful result should contain JSON with workflow: "n8n" and sum: 4. If the node returns an error, do not immediately run it again; classify the error first.
Where to inspect the execution log
Open Executions for the workflow and select the manual execution. Check:
- overall execution status;
- start time and duration;
- AI Agent input and output;
- the node where the process stopped;
- the error text without copying credentials or a sensitive prompt.
n8n distinguishes manual and production executions. A manual run starts in the editor and is suitable for testing. A production execution starts automatically after workflow publication or from a trigger. Keep the workflow unpublished until the provider route has been verified.
The distinction between run types and execution lists is documented in the n8n executions guide.
Execution data may include node input and output. For sensitive workflows, n8n supports redaction that hides data while retaining metadata such as status, timing, and node names. The prompt in this guide contains no personal data or secrets.
Limit retries and diagnose errors
Automatic retry is useful only for temporary errors. It also creates more API requests, which affects spend and makes one execution harder to reconcile.
401/ Unauthorized: do not retry automatically; first check the API key and surrounding spaces.403: do not retry automatically; check whether the key can access the selected model.404/ model not found: do not retry automatically; check the Base URL and exact Model ID.429: allow only a limited retry after a delay; check the rate limit and parallel run count.5xx/ timeout: do not exceed the configured limit; check provider status, Timeout, and prompt size.- Workflow error: do not retry before diagnosis; check the node, expression, and input data.
For the first test, keep Max Retries at the minimum and do not add a loop, Wait-and-retry branch, or error workflow that makes a new API request. For production retries, set a finite attempt count and delay, then check how many requests appeared in Dashboard.
An n8n error workflow is useful for failure notifications, but the notification itself is an external side effect. Add it only after a separate test and with its own limits.
The Error Trigger behavior and failed-execution data are described in the official error-handling guide.
Check tokens and cost in Dashboard
Open BetterToken Dashboard immediately after the single manual run. Match:
- the narrow n8n run window with the Dashboard request time;
- the Model ID in OpenAI Chat Model with the model in the usage record;
- the successful or failed status;
- input, output, and applicable cache tokens;
- the spend attached to that record.
Do not calculate cost from an old article or a fixed per-million-token number. Models and prices change. Use the actual charge for the call in Dashboard and the current rate on the BetterToken pricing page.
If one manual execution maps to several Dashboard rows, check Max Retries and agent-loop behavior. One visible workflow run can produce multiple model requests, especially with an agent loop or Responses tools. That is why the first test uses a fixed prompt, no tools, and minimal retries.
Common errors
The credential test returns 401
Recreate the OpenAI credential, remove spaces around the API key, and confirm that API Key mode—not OpenAI Account—is selected. Never print the key in an execution log.
The credential test or node returns 404
The Base URL must be https://www.bettertoken.ai/v1. Do not append /models or another endpoint. Reload the Model list and select a current ID.
Plain chat works but agent tools do not
Return to the minimal workflow: disable Use Responses API, remove Tool nodes, and send one fixed prompt again. This separates the provider connection from a limitation of a specific tool or workflow.
The execution succeeds but Dashboard shows several requests
Check Max Retries and the agent loop. Compare timestamps and statuses. Do not treat several rows as one call when n8n actually sent several requests.
FAQ
Must the workflow be published for testing?
No. A manual execution from the editor is enough. Publishing enables production triggers and can start external actions without another confirmation.
Can I use Responses API?
Only after separately verifying the selected model and endpoint. Use ordinary Chat Completions without built-in OpenAI tools for the first connection test.
Where should the BetterToken API key be stored?
In an n8n OpenAI credential. Do not duplicate it in node parameters, workflow JSON, prompts, or a repository.
How do I find the real cost of one workflow?
Run one manual execution with minimal retries, then match its time, Model ID, and status with the BetterToken Dashboard record. Use the tokens and spend from that record, not an estimate.