Integrations

n8n → AI24X

Use the HTTP Request node—no special AI24X plugin required.

HTTP Request node

  1. Method POST · URL https://api.ai24x.com/v1/chat/run
  2. Header X-API-Key = your key (store in n8n credentials / env)
  3. Header Content-Type = application/json
  4. JSON body as below; map prompt from previous nodes
{ "prompt": "{{ $json.text }}", "model": "flash", "max_tokens": 400 }

Parse the JSON response field your flow needs (usually the assistant text). Start with flash to control cost.

Prerequisites

  • An n8n instance, either cloud or self-hosted, on a version that includes the HTTP Request node.
  • An AI24X API key, saved as an n8n Header Auth credential named X-API-Key. Attaching a credential keeps the key out of the workflow itself, so you can share or export the workflow safely.
  • For self-hosted instances, outbound HTTPS access to api.ai24x.com from the container or host that runs n8n.

Store the key as a credential

  1. Open Credentials → New and pick Header Auth.
  2. Set Name to X-API-Key and Value to your AI24X key.
  3. Select that credential in the HTTP Request node rather than typing the header inline.

If a workflow is duplicated or moved between environments, the credential reference travels with it while the secret stays behind. Typing the key into the node defeats that.

Wiring the response into the next node

The HTTP Request node returns the parsed body as the item's JSON, so downstream nodes can reference it directly. Referencing the response field looks like this:

{{ $json.text }}

Before you build expressions, run the node once and open its Output tab. That shows the real field names for your account instead of the ones guessed in a tutorial. Then map the field you need in a Set node and keep the rest of the flow independent of the raw response shape.

Cost and rate control

  • Keep max_tokens modest on interactive flows. It caps the length of the answer and therefore the credits a single run can consume.
  • Stay on flash for classification, routing and enrichment steps, and reserve pro for the one step whose quality actually matters.
  • Add a small wait between iterations when a loop calls the API once per item, so a burst of items does not turn into a burst of requests.

Common errors and fixes

  • 401 Unauthorized — no credential attached, or the header name is spelled differently. It must match X-API-Key exactly.
  • 402 / insufficient credits — top up the AI24X credit balance and re-run the node.
  • 400 Bad Request — in the node's Body Content Type pick JSON. Leaving it on Form Url Encoded sends the payload in the wrong format.
  • 429 Too Many Requests — the flow is firing faster than your plan allows. Insert a Wait node or reduce batching.
  • Connection refused on self-hosted n8n — the container has no egress route. Test the same endpoint with the curl guide from inside the container.

Troubleshooting order

  1. Fix the endpoint with curl from the same host. If curl fails too, the problem is network or key, not n8n.
  2. Confirm the credential is attached and the header name matches.
  3. Confirm the body content type is set to JSON.
  4. Inspect the node's raw response before writing any expression.
  5. Only then look at loop timing, batching and rate limits.

Dify · curl · Pricing