Integrations

OpenAI-compatible pattern

Many tools only need base URL + API key + model. Prefer flash / pro.

HTTP

POST https://api.ai24x.com/v1/chat/run Header: X-API-Key: YOUR_API_KEY Header: Content-Type: application/json { "prompt": "Hello", "model": "flash", "max_tokens": 200 }

Python (requests)

import os, requests r = requests.post( "https://api.ai24x.com/v1/chat/run", headers={"X-API-Key": os.environ["AI24X_API_KEY"], "Content-Type": "application/json"}, json={"prompt": "Hello", "model": "flash", "max_tokens": 200}, timeout=60, ) print(r.status_code, r.text[:500])

VIP named model

After VIP is active, set model to a named id (see VIP list).

{ "prompt": "Hello", "model": "vip-kimi", "max_tokens": 200 }

This is the simple path that works today. More SDK-style examples will be added over time.

Prerequisites

  • Python 3.8 or newer with the requests library, or any HTTP client in another language.
  • An AI24X API key exposed as AI24X_API_KEY. Reading it with os.environ keeps the secret out of your source file.
  • The endpoint https://api.ai24x.com/v1/chat/run for the simple prompt form shown above, or https://api.ai24x.com/v1/chat/completions if you prefer the OpenAI-style messages array.

Check the status before you parse

An error response still carries a status code, so branch on it before touching the body:

import os, requests r = requests.post( "https://api.ai24x.com/v1/chat/run", headers={"X-API-Key": os.environ["AI24X_API_KEY"], "Content-Type": "application/json"}, json={"prompt": "Hello", "model": "flash", "max_tokens": 200}, timeout=60, ) if r.status_code != 200: raise RuntimeError(f"AI24X {r.status_code}: {r.text[:300]}") print(r.json())

Pass an explicit timeout on every call. Without one, a stalled connection can occupy a worker thread indefinitely.

Choosing a tier

Each request names a model. flash suits high-volume, forgiving work such as classification, extraction and summarising user input. Move a call to pro when it genuinely needs deeper reasoning or a longer context. Named VIP models use a vip- prefix, for example vip-kimi, and only resolve once VIP access is active on the account.

Because the request shape does not change between tiers, you can surface the tier as a configuration value and adjust your cost profile without editing calling code.

Common errors and fixes

  • 401 Unauthorized — the key is missing or wrong. Confirm AI24X_API_KEY is set in the environment that runs the process, not only in your shell.
  • 402 / insufficient credits — top up the AI24X credit balance, then repeat the identical request.
  • 400 Bad Request — the payload was not valid JSON. Pass a Python dict through json= rather than building a string by hand.
  • 429 Too Many Requests — you are sending faster than your plan allows. Reduce concurrency or add a short delay between calls.
  • Requests hang, then fail — no timeout was set, or an egress proxy is intercepting traffic. Set timeout and check the proxy configuration on the host.

Troubleshooting order

  1. Reproduce the call with curl to separate a key or network problem from a code problem.
  2. Print r.status_code and the first few hundred characters of r.text.
  3. Confirm the key is present in the environment that runs the process.
  4. Confirm the payload serialises as you expect.
  5. Only then look at timeouts and proxy settings.

OpenClaw · VIP named models · Docs · Pricing