Skip to main content
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:
The plain-text version of this page is https://docs.apiyi.com/en/developer-kit.md.

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, typing gpt-5-4-mini instead of gpt-5.4-mini, or adding an extra /v1 to the Anthropic SDK base URL. Five rules stop that:
  1. Do not invent endpoints, parameter names, enum values or response shapes. Use only the paths in the skill.md endpoint table; parameters follow the official definition of the protocol in use (OpenAI, Anthropic or Gemini).
  2. model-registry.json is 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.
  3. Pick the base URL by SDK, not by model. The OpenAI SDK uses https://api.apiyi.com/v1; the Anthropic SDK uses the root https://api.apiyi.com; the Google GenAI SDK uses the root with api_version set to v1beta.
  4. Read the key only from the APIYI_API_KEY environment variable. Never hardcode it, commit it or paste it into a chat.
  5. 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.

Skills

The skill is skill.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:
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_KEY comes first. The skill, the CLI and every example in these docs read it from there.
  • OpenClaw stores the key at skills.entries.apiyi.apiKey in ~/.openclaw/openclaw.json and injects it as APIYI_API_KEY at run time. That is what the primaryEnv field in the skill frontmatter declares. See OpenClaw configuration file for the file layout.
  • The CLI saves it with npx apiyi@latest auth set-key to ~/.config/apiyi/config.json with mode 0600.

Self-check statuses

The skill script, the CLI and a manual curl all return the same status set:
A normal sk- key cannot read the balance, so there is no no_balance status. Balance and logs use a separate system token, see How to view call logs. A 429 can mean either rate limiting or an empty balance. The agent should not guess; it should point you to the console.

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.

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.