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.
npx skills add nikandr-surkov/ai-saas-starter --skill add-ai-providergit clone --depth 1 https://github.com/nikandr-surkov/ai-saas-starterWrote 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.
[](https://agentmods.dev/skills/nikandr-surkov/ai-saas-starter/add-ai-provider)<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.
<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>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.
| Model | Per session | Once 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 |
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.
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
- Ask the user first — a new provider almost always means a new dependency, and dependencies need approval (AGENTS.md).
- Create
src/lib/ai/<provider>.tsexporting an object that satisfies theImageProviderinterface. Keep it thin: call the API, normalize the response to{ url, width, height, model }, throw on failure. - 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)
- Wire selection where the provider is chosen (see how
gateway.tsand theAI_MOCKflag are dispatched) — selection stays env-driven, no provider conditionals in UI or actions. - 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.
- 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.
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.
- 11d ago First seen · 41 lines · 35 tokens per session scan A 6be6037eeff3
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.
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.
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.
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.
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…
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.
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.