AnyModel API

Вызывает Claude, GPT, Gemini и другие модели через API AnyModel – совместимый с OpenAI и Anthropic, один ключ на всё – и подключает к нему код или агента. Нужен, когда надо вызвать LLM из кода, сменить провайдера или подключить инструмент к AnyModel.

Модели и APIПак: AnyModel125 строкanymodel-api

Установка

Выполните одну команду — она сохранит SKILL.md в папку скиллов агента. Перезапустите агента, и он подхватит скилл сам.

Claude Code — macOS, Linux
mkdir -p ~/.claude/skills/anymodel-api && curl -fsSL https://anymodel.org/en/skills/anymodel/anymodel-api/SKILL.md -o ~/.claude/skills/anymodel-api/SKILL.md
Codex, Cursor — macOS, Linux
mkdir -p ~/.agents/skills/anymodel-api && curl -fsSL https://anymodel.org/en/skills/anymodel/anymodel-api/SKILL.md -o ~/.agents/skills/anymodel-api/SKILL.md
Claude Code — Windows PowerShell
New-Item -ItemType Directory -Force "$HOME\.claude\skills\anymodel-api" | Out-Null; Invoke-WebRequest https://anymodel.org/en/skills/anymodel/anymodel-api/SKILL.md -UseBasicParsing -OutFile "$HOME\.claude\skills\anymodel-api\SKILL.md"
Codex, Cursor — Windows PowerShell
New-Item -ItemType Directory -Force "$HOME\.agents\skills\anymodel-api" | Out-Null; Invoke-WebRequest https://anymodel.org/en/skills/anymodel/anymodel-api/SKILL.md -UseBasicParsing -OutFile "$HOME\.agents\skills\anymodel-api\SKILL.md"

Другой агент: сохраните файл в его папку скиллов или дайте ему ссылку на файл: https://anymodel.org/en/skills/anymodel/anymodel-api/SKILL.md

SKILL.md

Исходник

AnyModel API

AnyModel exposes many models (Claude, GPT, Gemini, DeepSeek, Kimi and others) behind one endpoint and one key, billed per token from a single balance.

  • Base URL: https://anymodel.org/v1
  • Auth: Authorization: Bearer $ANYMODEL_API_KEY (or x-api-key for the Anthropic format)
  • Key: created in the AnyModel dashboard after sign-up at https://anymodel.org/app/register

Ground rules

  1. Read the key from the environment (ANYMODEL_API_KEY). Never hardcode it, never print it, never commit it. If the project has a .env.example, add the variable name there without a value.

  2. Do not guess model ids. List them first and pick from the response:

    curl -s https://anymodel.org/v1/models \
      -H "Authorization: Bearer $ANYMODEL_API_KEY" | jq -r '.data[].id'
    
  3. Prefer the format the code already uses. Code on the OpenAI SDK keeps the OpenAI SDK and only changes the base URL and key; code on the Anthropic SDK keeps the Anthropic SDK.

OpenAI format (/v1/chat/completions, /v1/responses)

curl -s https://anymodel.org/v1/chat/completions \
  -H "Authorization: Bearer $ANYMODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "<model-id>", "messages": [{"role": "user", "content": "Hello"}]}'

Python (official openai package):

import os
from openai import OpenAI

client = OpenAI(base_url="https://anymodel.org/v1", api_key=os.environ["ANYMODEL_API_KEY"])
reply = client.chat.completions.create(
    model="<model-id>",
    messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)

Node (official openai package):

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://anymodel.org/v1", apiKey: process.env.ANYMODEL_API_KEY });
const reply = await client.chat.completions.create({
  model: "<model-id>",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(reply.choices[0].message.content);

Streaming works the usual way (stream: true); handle the stream exactly as with the vendor API.

Anthropic format (/v1/messages)

import os
from anthropic import Anthropic

client = Anthropic(base_url="https://anymodel.org", api_key=os.environ["ANYMODEL_API_KEY"])
msg = client.messages.create(
    model="<model-id>",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text)

The Anthropic SDK appends /v1/messages itself, so its base URL is the host without /v1.

Connecting a coding agent

AnyModel ships a one-line installer that writes the agent's config. The key is passed at run time:

# macOS / Linux; tool = claude | codex | opencode | cursor | zed | cline | kilo | copilot | droid
bash <(curl -fsSL "https://anymodel.org/i?tool=claude") "$ANYMODEL_API_KEY"
# Windows PowerShell
$env:AM_KEY = $env:ANYMODEL_API_KEY; irm "https://anymodel.org/i?os=windows&tool=claude" | iex

Run the installer only after the user confirms: it rewrites the agent's config in the home directory (a .bak copy is kept). Read the script first if the user asks what it changes. For tools without an installer (Windsurf and other OpenAI-compatible clients) add a custom OpenAI-compatible provider with base URL https://anymodel.org/v1, the key, and a model id from /v1/models.

Checking the balance

curl -s https://anymodel.org/v1/balance -H "Authorization: Bearer $ANYMODEL_API_KEY"

Errors

  • 401 — missing or wrong key: check the variable is exported in the same shell or process. A 401 whose message says the balance has run out is a balance problem: top up, the key is fine.
  • 402 / balance errors — top up in the dashboard; do not retry in a loop.
  • 403 Account is blocked / 403 Account is inactive — the account behind the key is not active. No code or key change fixes it: stop retrying and tell the user to contact AnyModel support.
  • 400 Invalid model / 404 … The model is not configured — the id is not in /v1/models; list again and pick an existing one.
  • 429 / 5xx — retry with exponential backoff and jitter, at most a few times.

Report back

Tell the user which files changed, which variable they must set (ANYMODEL_API_KEY), which model id was chosen and why, and the exact command you ran to verify the call worked.

Source: AnyModel skills catalog · License: CC BY 4.0

Подключить через AnyModel API

Скилл работает на той модели, которую использует агент. Подключите Claude Code, Codex или Cursor к AnyModel и запускайте его на Claude, GPT, Gemini и других моделях по одному ключу — оплата за токены, без подписки.

Ещё из пака AnyModel