Wiro AI for Next.js
Build Next.js App Router features on Wiro AI, the API for 1,000+ image, video, speech, music and LLM models. Keeps the API key in route handlers and server…
от wiroai204 установки в других каталогах
Установить Wiro AI for Next.js в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Wiro AI in Next.js
Wiro AI runs 1,000+ models through one API. A run is a task: start it with POST /Run/{owner}/{model}, follow it with POST /Task/Detail, and read the files from the finished task. Chat models also answer through the OpenAI-compatible LLM gateway at https://llm.wiro.ai/v1. Only successful runs are billed, from the prepaid wallet of the project that owns the key.
This skill is the Next.js App Router layer. For every Run API detail (all statuses, error codes, workflows, the MCP server), use the wiro-ai skill from wiroai/Wiro-Plugin. For the gateway in depth, use the wiro-llm skill from wiroai/Wiro-LLM.
Each code block below is a file in examples/ next to this file, at the path in its first line. The CI of wiroai/Wiro-Next-Starter type-checks every one of them against the starter's own code.
Rules
- The key stays on the server. Read
WIRO_API_KEY, plusWIRO_API_SECRETfor a Signature project, from server environment variables. Never prefix them withNEXT_PUBLIC_, never import them into a client component, and never log them or send them in a response. Call Wiro from route handlers and server actions, and start server helper modules withimport 'server-only'. - If the variables are missing, ask the user to create a project at https://wiro.ai/panel/project/new and set them in
.env.localand on their host. Do not ask them to paste a key into the chat. - The server decides. It picks the model and checks every input; the browser sends only what the user typed. The browser gets the task token (
socketaccesstoken) to follow its own run, never the key and never other task ids. - Show the price before the run, from the model's price list (section 2), and the billed amount (
totalcost) after it. - A run is a paid job. After a timeout or a dropped connection, read the task before you start anything again: a second Run is a second charge.
- Public apps need a ceiling. Use a key from a separate Wiro team with a team spend limit, refuse runs above a price, and add a password if strangers should not use the app. Wiro-Next-Starter does this with
MAX_RUN_PRICEandBASIC_AUTH_PASSWORD.
1. A server helper
// lib/wiro.ts
import 'server-only';
import { createHmac } from 'node:crypto';
const RUN_API = 'https://api.wiro.ai/v1';
/** One task, as Task/Detail and the webhook send it. Only the fields most apps read. */
export type WiroTask = {
id?: string;
socketaccesstoken?: string;
status?: string;
/** "0" when the run succeeded. Only successful runs are billed. */
pexit?: string;
/** The text of an LLM. Models that make files write progress logs here. */
debugoutput?: string;
/** The billed amount in USD, as text. */
totalcost?: string;
outputs?: { name?: string; contenttype?: string; url?: string }[];
};
/** Only these two statuses end a task. `task_error` does not. */
export const isFinal = (task: WiroTask) => task.status === 'task_postprocess_end' || task.status === 'task_cancel';
export const succeeded = (task: WiroTask) => task.status === 'task_postprocess_end' && task.pexit === '0';
let lastNonce = 0;
function authHeaders(): Record<string, string> {
const apiKey = process.env.WIRO_API_KEY;
if (!apiKey) throw new Error('Set WIRO_API_KEY in the server environment.');
const apiSecret = process.env.WIRO_API_SECRET;
if (!apiSecret) return { 'x-api-key': apiKey };
// Signature project: a fresh nonce and the hex HMAC-SHA256 of secret + nonce, keyed with the API key.
lastNonce = Math.max(Date.now(), lastNonce + 1);
const nonce = String(lastNonce);
const signature = createHmac('sha256', apiKey)
.update(apiSecret + nonce)
.digest('hex');
return { 'x-api-key': apiKey, 'x-nonce': nonce, 'x-signature': signature };
}
type WiroError = string | { code?: number; message?: string };
/** One POST to the Run API. Wiro answers HTTP 200 with `result: false` when it refuses, so read the body. */
export async function wiro<T>(path: string, body: Record<string, unknown> | FormData): Promise<T> {
const isForm = body instanceof FormData;
const response = await fetch(`${RUN_API}${path}`, {
method: 'POST',
headers: isForm ? authHeaders() : { ...authHeaders(), 'Content-Type': 'application/json' },
body: isForm ? body : JSON.stringify(body),
cache: 'no-store',
});
const data = (await response.json()) as T & { result?: boolean; errors?: WiroError[] };
if (data.result !== true) {
const error = data.errors?.[0];
const message = typeof error === 'string' ? error : (error?.message ?? `HTTP ${response.status}`);
const code = typeof error === 'object' ? error.code : undefined;
// Code 96: too many tasks at once, retry later. Code 97: the balance is too low.
throw new Error(`Wiro AI refused the request${code === undefined ? '' : ` (code ${code})`}: ${message}`);
}
return data;
}
/** Starts a run of `owner/model` and returns its task token. */
export async function runModel(mode
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл Wiro AI for Next.js?
Build Next.js App Router features on Wiro AI, the API for 1,000+ image, video, speech, music and LLM models. Keeps the API key in route handlers and server actions, finds models in the Wiro catalog and shows the price before a run, starts tasks on the server and follows them by polling or a webhook, uploads input files, and streams chat from the Wiro LLM gateway with the AI SDK. Use when adding Wiro AI to a Next.js app, or when working in the wiroai/Wiro-Next-Starter repository.
Как установить скилл Wiro AI for Next.js?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Wiro AI for Next.js запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…