n8n · AI Agent

Connect n8n AI Agent to Tikway: OpenAI Chat Model and a tool test

Last updated:

An n8n AI Agent connects a chat model to tools. Tikway supplies the model API; n8n executes the workflow and tools. Configure the OpenAI Chat Model credentials and endpoint, then attach a simple calculator to inspect the first complete tool flow.

1. Select the model and endpoint

Copy a full text model ID from the model catalog that supports OpenAI protocol, Chat Completions, and Function Calling. Context size, tool support, and pricing vary by model. A text response alone does not establish Agent compatibility.

Create a Tikway Key in the console. Use https://api.tikway.ai/v1 as the Base URL; chat requests should reach /v1/chat/completions.

This guide describes node configuration and self-validation, not a completed end-to-end test on your n8n instance, account, or selected model. Executing a node or workflow sends real model requests and incurs applicable API charges.

2. Configure OpenAI Chat Model

Create a test workflow with Chat Trigger and AI Agent, and connect the trigger’s main output to the Agent. Add an OpenAI Chat Model subnode to the Agent’s Chat Model connector.

Create or edit an OpenAI-type credential and enter your Tikway API Key. In the credential’s Base URL field, replace the default https://api.openai.com/v1 with https://api.tikway.ai/v1, then save. Do not append /chat/completions. Legacy model nodes may also expose Base URL under Options; check the current version’s credential interface first.

Setting Value
API Key Key created in the Tikway console
Credential Base URL https://api.tikway.ai/v1
Model Full Tikway model ID; use the interface’s manual ID input if it is not listed
Use Responses API Off; this tutorial uses Chat Completions
Output limit and timeout Values supported by your selected model and task

If the interface only accepts a fixed official endpoint or model list and cannot use these values, stop and check the node version. This configuration is for the OpenAI Chat Model subnode; the regular OpenAI action node has different behaviors and settings.

3. Attach a calculator and bound the loop

Add Calculator to the AI Agent’s Tool connector. Arithmetic is a useful first test because the expected result can be checked without business data or external actions.

If the prompt comes from Chat Trigger, retain its chatInput source. If you choose a manually defined prompt, enter the test explicitly. A simple system message is:

text
You are a math assistant. Use the Calculator tool when the user requests a calculation.
Answer from the tool result. If the tool fails, report the error instead of inventing a result.

Set Max Iterations to 3 and turn on Return Intermediate Steps in the Agent options for this first test. Option placement can vary by node version.

Send through Chat Trigger:

text
Use the Calculator tool to calculate 17 + 25, then report the result.

4. Inspect execution details

A useful minimum trace includes a successful model request, a Calculator call, its expression or arguments, a result of 42, and the final model answer after the tool result. Inspect intermediate steps and execution details, then reconcile matching Tikway console records.

An answer saying “42” without a recorded Calculator execution only verifies a text answer. Saved credentials and connected nodes do not establish working tool calls.

Leave Memory out of the initial test. After the basic flow works, add Simple Memory or another suitable subnode and test multiple conversation turns. History and tool results increase subsequent model input. Check workflow retries, Agent iterations, and model retries together so that overlapping retry layers do not inflate request counts.

5. Troubleshoot n8n Agent errors

Symptom Check
Credential test fails Whether the custom endpoint is active; a credential test may request a model list, so distinguish listing from chat requests
401 Tikway Key, whitespace, and the credential actually referenced by the node; see the 401 guide
404 or HTML Actual host and path, duplicate /v1, or the website’s business /api path
Rejected tools fields Function Calling support and the selected model node / Agent strategy
Calculator was not called Tool connector, tool description, prompt, and intermediate trace
Maximum iterations reached Tool output format, arguments, result messages, and repeated tool requests
Responses-related errors Turn off Use Responses API and inspect the actual Chat Completions request path

Chat Completions tool calling does not automatically enable OpenAI built-in web search, file search, or code execution. n8n-connected tools, model provider built-in tools, and MCP are distinct integrations.

6. Estimate costs and expand gradually

A local tool can be free while the Agent’s model requests still incur charges. External tools can have separate costs. Use the token cost calculator for text request estimates, then account for actual model turns, growing context, and console records.

When adding HTTP Request, workflow tools, or MCP, introduce one tool at a time and retain argument checks and iteration limits. Providing the model endpoint does not establish compatibility with every third-party tool or n8n node combination.

Next: Agent API setup and model selection · LangChain tutorial · Dify tutorial · model catalog

References: n8n OpenAI Chat Model · n8n Tools Agent · OpenAI credential field source. Check the current version’s controls before running the minimum validation task.