KIE (api.kie.ai) serves its chat models over each vendor's own wire protocol. When the agent speaks the same protocol as the model, no adapter is needed. When they differ, a local translation proxy has to sit in between; see When protocols don't match below.
One section per agent, each self-contained: how to list the models that agent can run, what configuration it needs, and how it fails. Codex CLI, Claude Code and Grok Build are covered so far; other agents will be added later as sibling sections. The protocol-mismatch section is shared, so a new agent does not need its own pairing table.
WARNING
⚠️ Use the latest models for agent features
For agent features, use the latest model in each series. Some older models currently support chat requests only; connecting them to an agent may cause request errors or unexpected results. These models are marked "Chat only" on their model pages in the Market. The models each agent can use are listed in that agent's model listing.
npx skills add https://kie.ai
Once installed, you can simply ask your agent, for example "Configure Codex to use KIE", and the skill follows the steps on that agent's page. You can also configure the agent by hand with the pages below.
A KIE API key created at https://kie.ai/api-key, exported as KIE_API_KEY, and the agent you want to configure already installed.
The model-listing snippets need curl and jq on your PATH. Most systems do not ship jq: brew install jq, apt install jq or winget install jqlang.jq.
In PowerShell, curl is an alias for Invoke-WebRequest and does not accept these arguments. Write curl.exe as in the Windows snippets below. Under cmd.exe the snippets must be rewritten; they cannot be pasted as is.
Summarized from the agent pages; see each page for details.
| Agent | Protocol | List models | Where the config goes | Base URL | Credential |
|---|---|---|---|---|---|
| Claude Code | Anthropic Messages | GET https://api.kie.ai/anthropic/v1/models | Environment variables, or env in ~/.claude/settings.json | ANTHROPIC_BASE_URL=https://api.kie.ai/anthropic | Raw key in ANTHROPIC_AUTH_TOKEN |
| Codex CLI | OpenAI Responses | GET https://api.kie.ai/openai/v1/models | [model_providers.kie] in ~/.codex/config.toml | https://api.kie.ai/openai/v1 | env_key = "KIE_API_KEY" |
| Grok Build | Responses (api_backend = "responses") | GET https://api.kie.ai/xai/v1/models | [model.kie] in ~/.grok/config.toml | https://api.kie.ai/xai/v1 | env_key = "KIE_API_KEY" |
Rules shared by all three agents:
Authorization: Bearer. A header literally named apikey is rejected with 401./v1/messages or /responses itself.Every agent here speaks one wire protocol, and every KIE listing is served over one protocol. When the two match, configure the agent as its page says and traffic goes straight to api.kie.ai. When they don't, you need a local translation proxy.
api.kie.ai.| Model listing | KIE request | Protocol |
|---|---|---|
GET /openai/v1/models | POST /openai/v1/responses | Responses |
GET /anthropic/v1/models | POST /anthropic/v1/messages | Messages |
GET /xai/v1/models | POST /xai/v1/responses | Responses |
The proxy listens on the path the agent will build and forwards to the KIE request for that listing. Both directions must be translated, including the streaming and tool calls the agent actually sends. Authentication to KIE is Authorization: Bearer $KIE_API_KEY.
When a future agent's listing is not in this table, add a row. The rules in this section do not change.
Only write one when the user explicitly asks. Map honestly; do not invent platform behavior.
claude --debug, Codex logs, GROK_LOG_FILE) and the shape KIE expects on the model path. Field tables pieced together from training data are usually incomplete.model id unchanged. Do not hard-code a default model name, and do not rewrite sonnet / opus / claude-* into GPT slugs, or the other way round.GET /models, return the list in the shape the agent expects, with data from the model side's KIE listing. Passing the other side's document through as is has the wrong shape. A failed listing is an error; do not invent a fake model.id / call_id / tool_use_id stay consistent between the request and the tool result in the next turn. Do not drop tools. If KIE rejects tools, pass that error back.The listen address is whatever the proxy binds. The agent's base URL still follows the rules on its page: Claude Code appends /v1/messages to ANTHROPIC_BASE_URL, Codex appends /responses to base_url, and Grok Build appends /responses to base_url when api_backend = "responses". So leave that suffix out of the value.
Claude Code running a Responses model:
export ANTHROPIC_BASE_URL=http://127.0.0.1:<port>
export ANTHROPIC_AUTH_TOKEN=$KIE_API_KEY
export ANTHROPIC_MODEL=…
ANTHROPIC_MODEL is an id from GET /openai/v1/models, not Claude Code's sonnet / opus aliases.
Codex CLI running a Messages model:
model = "…"
model_provider = "kie"
[model_providers.kie]
name = "KIE"
base_url = "http://127.0.0.1:<port>/v1"
env_key = "KIE_API_KEY"
wire_api = "responses"
model is an id from GET /anthropic/v1/models. base_url still does not include /responses.
Do not leave the agent's base URL pointing at api.kie.ai while sending an id from another listing, and do not point the agent straight at the model side's KIE prefix without translation.
This skill does not include, generate or name any translation proxy. It only states the listen path, the KIE path, which listing to read, and which agent setting takes the proxy address. Proxy code is written only when the user explicitly asks.