add-ai-provider

add-ai-provider is a skill for Claude Code from nikandr-surkov/ai-saas-starter. It costs 35 tokens per session (420 once invoked), scanned A, original, MIT.

A guide for adding a new image-generation service to an application that already supports image providers. It defines the provider interface, environment settings, selection logic, error handling, and tests.

In plain words
What is it for?
Use it when connecting services such as fal, Replicate, or OpenAI to an image-generation feature, including adding configuration, routing provider selection, normalizing responses, and testing failures.
Why use it?
It keeps a new service compatible with the application's existing image-generation flow. It also helps avoid changing unrelated billing or credit handling when the provider fails.

Skill for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions AGENTS.md.

Good fit Use it when connecting services such as fal, Replicate, or OpenAI to an image-generation feature, including adding configuration, routing provider selection, normalizing responses, and testing failures.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nikandr-surkov/ai-saas-starter/add-ai-provider
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add nikandr-surkov/ai-saas-starter --skill add-ai-provider
Clone the repo
git clone --depth 1 https://github.com/nikandr-surkov/ai-saas-starter

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-ai-provider

README.md
[![agentmods](https://agentmods.dev/badge/skills/nikandr-surkov/ai-saas-starter/add-ai-provider/github.svg)](https://agentmods.dev/skills/nikandr-surkov/ai-saas-starter/add-ai-provider)
Your own site
<a href="https://agentmods.dev/skills/nikandr-surkov/ai-saas-starter/add-ai-provider"><img src="https://agentmods.dev/badge/skills/nikandr-surkov/ai-saas-starter/add-ai-provider/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for add-ai-provider

Your own site · 80×15
<a href="https://agentmods.dev/skills/nikandr-surkov/ai-saas-starter/add-ai-provider"><img src="https://agentmods.dev/badge/skills/nikandr-surkov/ai-saas-starter/add-ai-provider.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 35 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 420 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00035 $0.00420
Opus 5 $0.00017 $0.00210
Sonnet 5 $0.00007 $0.00084
Haiku 4.5 $0.00003 $0.00042

Measured 11d ago against content hash 6be6037eeff3, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

add-ai-provider scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/add-ai-provider/SKILL.md · 41 lines

What it actually says

Add an AI provider

The contract lives in src/lib/ai/provider.ts:

generateImage({ prompt, userId }): Promise<{ url; width; height; model }>;

The default implementation is src/lib/ai/gateway.ts (Vercel AI Gateway). Read both files before writing anything.

Steps

  1. Ask the user first — a new provider almost always means a new dependency, and dependencies need approval (AGENTS.md).
  2. Create src/lib/ai/<provider>.ts exporting an object that satisfies the ImageProvider interface. Keep it thin: call the API, normalize the response to { url, width, height, model }, throw on failure.
  3. Config comes from env. Add the new vars to:
    • src/lib/env.ts (Zod schema, optional unless the provider is active)
    • .env.example (with a comment and a link to where keys come from)
  4. Wire selection where the provider is chosen (see how gateway.ts and the AI_MOCK flag are dispatched) — selection stays env-driven, no provider conditionals in UI or actions.
  5. Do not touch the credits flow. The generate action already spends before calling the provider and refunds on failure. Your provider just throws on error; the action handles money.
  6. Test: unit-test the response normalization with a mocked HTTP layer. Then run the e2e generate flow with the real provider once, manually.

Scope note

This repo intentionally ships one provider. Multi-provider image/video/audio with job queues, auto-refunds and gallery storage is what the Pro version is for (https://nikandr.com) — don't rebuild it ad hoc here.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 41 lines · 35 tokens per session scan A 6be6037eeff3

Subscribe to this mod's changes

add-ai-provider is a skill published in the GitHub repository nikandr-surkov/ai-saas-starter (19 stars, last pushed 1mo ago), licensed MIT. It adds 35 tokens to every session and 420 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

ai-model-api-gateway-ai-hive

A workflow for designing an AI model API gateway, a service that gives applications one managed entry point to multiple AI model providers.

wubin1836/ai-hive-agent-skills · 223 tokens

ai-api-gateway-migration-guide-ai-hive

A migration guide for teams comparing an AI API gateway, which connects software to multiple AI providers, with AI-HIVE.

wubin1836/ai-hive-agent-skills · 161 tokens

ai-hive-api-token-hub

An enterprise gateway for connecting applications to multiple AI model providers through one interface. It covers tenant separation, API keys, usage limits, routing, task tracking, billing, logs and failover.

wubin1836/ai-hive-agent-skills · 132 tokens

openai-api

Build with OpenAI stateless APIs - Chat Completions (GPT-5.2, o3), Realtime voice, Batch API (50% savings), Embeddings, DALL-E 3, Whisper, and TTS. Prevents 16 documented errors. Use when: implementing GPT-5 chat, streaming, function calling, embeddings for RAG, or troubleshooting rate limits (429), API errors…

coco-research/coco · 96 tokens

ai-api-failover-routing-ai-hive

A workflow for designing and testing fallback routes between AI APIs, meaning backup paths used when a model request fails.

wubin1836/ai-hive-agent-skills · 163 tokens

gemini-api-agent-platform

Guides the usage of the Gemini API on Agent Platform with the Google Gen AI SDK for enterprise AI applications. Covers SDK usage (Python, JS/TS, Go, Java, C#), capabilities like Live API, tools, multimedia generation, caching, and batch prediction.

davila7/claude-code-templates · 61 tokens