The account and the key still have to be created by you in the console. Everything from “I have a key” to “the code works” can be delegated to an AI through any of the three paths below.
Pick a path
Skills · chat agents
OpenClaw, Claude Code and other agents with a skills system. Install the skill once, then call APIYI in natural language.
CLI · terminal
No code. Verify a key, list models, send a message and generate an image from the terminal.
npx apiyi@latest check needs no install.Developer kit · coding agents
Cursor, Claude Code and Codex read the contract and the model registry before writing integration code. No invented endpoints.
What is in the kit
Every file is public. No login is needed, and any agent can fetch them directly:Rules for coding agents
The most common failure of a coding agent is not bad code. It is writing from memory: inventing an endpoint that does not exist, typinggpt-5-4-mini instead of gpt-5.4-mini, or adding an extra /v1 to the Anthropic SDK base URL. Five rules stop that:
- Do not invent endpoints, parameter names, enum values or response shapes. Use only the paths in the
skill.mdendpoint table; parameters follow the official definition of the protocol in use (OpenAI, Anthropic or Gemini). model-registry.jsonis the single source of truth for model IDs. IDs are dot-versioned and case-sensitive. The hyphens in documentation URLs are URL-safe replacements, not model IDs.- Pick the base URL by SDK, not by model. The OpenAI SDK uses
https://api.apiyi.com/v1; the Anthropic SDK uses the roothttps://api.apiyi.com; the Google GenAI SDK uses the root withapi_versionset tov1beta. - Read the key only from the
APIYI_API_KEYenvironment variable. Never hardcode it, commit it or paste it into a chat. - Explain first, then edit. Have the agent state which endpoint, which model and what timeout it intends to use. It edits code only after you confirm.
Full prompt for Cursor, Claude Code, Codex and other coding agents. Copy and paste as is.
What this prompt protects you from
What this prompt protects you from
Skills
The skill isskill.md itself: an integration reference written for machines. Once installed, the agent recalls these rules whenever it needs to call APIYI. Three ways to install it:
- npx skills (generic)
- OpenClaw
- Manual copy
For Claude Code, Cursor, Codex and any other tool that supports the Agent Skills spec:Discovery goes through this site’s
/.well-known/agent-skills/index.json. This installs skill.md itself without scripts; use npx apiyi@latest check for the self-check.For OpenClaw, Claude Code, Cursor and other agents that support skills. Copy and paste as is.
How the key reaches the agent
- The environment variable
APIYI_API_KEYcomes first. The skill, the CLI and every example in these docs read it from there. - OpenClaw stores the key at
skills.entries.apiyi.apiKeyin~/.openclaw/openclaw.jsonand injects it asAPIYI_API_KEYat run time. That is what theprimaryEnvfield in the skill frontmatter declares. See OpenClaw configuration file for the file layout. - The CLI saves it with
npx apiyi@latest auth set-keyto~/.config/apiyi/config.jsonwith mode 0600.
Self-check statuses
The skill script, the CLI and a manual curl all return the same status set:CLI
Get the first call working from the terminal without writing code. Node 18 or newer, nothing to install:For any agent that can run terminal commands, or run the lines yourself.
Commands
Global flags:
--api-key, --node api|vip|b|cf (pick a node), --base-url, --timeout, --json (machine-readable output).
Key lookup order
--api-key flag, then the APIYI_API_KEY environment variable, then ~/.config/apiyi/config.json, then OpenClaw’s ~/.openclaw/openclaw.json. If you already installed the OpenClaw skill, the CLI reuses that key.
Exit codes
Scripts and agents branch on the exit code instead of parsing text:
Source is at
github.com/apiyi-com/cli; the npm package is apiyi. The docs always write npx apiyi@latest because npx caches old versions.
model-registry.json fields
Regenerated every time the pricing table is refreshed, from the same data as the model pricing page. Top-level fields:
Each model entry:
Prices in the registry are list prices. They exclude recharge bonuses and group discounts; actual charges follow the console. Groups are explained in Groups explained.
Related pages
Getting started
Two paths: let an AI integrate, or do it yourself.
Is there one-click integration?
Yes, in the form of handing the docs to an AI rather than a button.
OpenClaw
Open-source local AI assistant; with the skill installed it calls APIYI in natural language.
Model pricing
The human-readable version of the registry, grouped by vendor with tiered prices.