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 MacPaw/ai-sdk-typescript --skill integrate-ai-gatewaygit clone --depth 1 https://github.com/MacPaw/ai-sdk-typescriptWrote 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/macpaw/ai-sdk-typescript/integrate-ai-gateway)<a href="https://agentmods.dev/skills/macpaw/ai-sdk-typescript/integrate-ai-gateway"><img src="https://agentmods.dev/badge/skills/macpaw/ai-sdk-typescript/integrate-ai-gateway/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/macpaw/ai-sdk-typescript/integrate-ai-gateway"><img src="https://agentmods.dev/badge/skills/macpaw/ai-sdk-typescript/integrate-ai-gateway.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 1 finding, up to medium
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- medium Data Exfiltration · line 60 Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
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.00071 | $0.01101 |
| Opus 5 | $0.00036 | $0.00550 |
| Sonnet 5 | $0.00014 | $0.00220 |
| Haiku 4.5 | $0.00007 | $0.00110 |
Grade A, and why
integrate-ai-gateway 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 9d 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.
How it starts
The opening of the file, as written. The whole thing — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AI Gateway Integration (@macpaw/ai-sdk)
Goal
Detect the app shape, choose one integration path, apply the smallest correct patch, add safe auth/error handling, run verification, and report exact changes.
Package surface
- Use
@macpaw/ai-sdkforcreateAIGatewayProvider,createGatewayProvider,createGatewayFetch,createVideoClient,GATEWAY_PROVIDERS, errors, andGatewayProviderSettings. - Use
@macpaw/ai-sdk/provideronly as a compatibility alias. - Use
@macpaw/ai-sdk/nestjsforAIGatewayModule,@InjectAIGateway(), andAIGatewayExceptionFilter. - Do not use
createAIGatewayClient,@macpaw/ai-sdk/client,runtime,types, ortesting; they do not exist. - For UI hooks or schema helpers, follow the versioned upstream docs for the installed
ai/@ai-sdk/reactmajor version; this package does not redefine those APIs.
Guardrails
- Do not invent a token source. If server-side token retrieval is unclear, ask one question.
- Do not place real tokens in browser-only code. Frontend-only apps need a backend/BFF token source.
- Do not remove direct OpenAI/Anthropic paths unless all usages are migrated or the user asked for it.
- Use
baseURLfor staging/custom hosts.envsupports only'production'. createGatewayFetchrequires a resolvedbaseURL; do not pass onlyenv. PreferresolveGatewayBaseURL()when you want the default production host.
Choose one path
- NestJS markers:
@nestjs/common,*.module.ts, decorators -> use@macpaw/ai-sdk/nestjs+@macpaw/ai-sdk. - Next.js / Vercel markers:
next,ai,@ai-sdk/*-> keep generation onai, swap only the model provider. - Express/Fastify/Hono/server scripts -> use
createGatewayFetch, orai+ provider if already Vercel-shaped. - Video generation (create job, poll status, fetch content) -> use
createVideoClient. - Existing
openai,@ai-sdk/openai, or@anthropic-ai/sdkusage -> treat as migration, not greenfield.
Canonical patterns
// Vercel AI SDK
const gateway = createAIGatewayProvider({
env: 'production',
getAuthToken: async () => process.env.AI_GATEWAY_TOKEN ?? null,
});
const result = streamText({ model: gateway('openai/gpt-4o'), messages });
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.
- 9d ago First seen · 102 lines · 71 tokens per session scan A 966d9eaaa35e
integrate-ai-gateway is a skill published in the GitHub repository MacPaw/ai-sdk-typescript (58 stars, last pushed 2d ago), licensed MIT. It adds 71 tokens to every session and 1,101 once invoked, about $0.0004 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
calling-llms
Use when sending chat completions through liter-llm and routing to a specific provider via the provider/model prefix. Covers the chat call shape, provider routing, modelhint, message roles, and error categories.
running-the-proxy
Use when running the liter-llm api OpenAI-compatible gateway — virtual keys, per-key rate limits, budgets, cost tracking, and model routing. Covers the TOML config and the 22 REST endpoints.
streaming-responses
Use when streaming tokens incrementally from an LLM via liter-llm over SSE or async iterators. Covers chatstream, delta handling, and null-content chunks.
fsl-business
Write and verify FSL business-layer specs for consultants, business owners, and PMs explicitly working on business-flow policy. Use for As-Is/To-Be process flows, actors, case stages, business policies, controls, KPIs, goals, and reform/control-preservation checks. Do not use for system requirements, UI/API/data-model…
vercel-ai-sdk-streaming
Build streaming AI features in Next.js with Vercel AI SDK, tool calling, RSC/UI hooks, and edge-safe API routes. Use for TypeScript fullstack AI UX with React Server Components.
creating-agents-in-medusa
Use when building an internal admin-facing AI agent in a Medusa project. These agents are operated by merchants and store operators — not customers. Covers data models, module service, agent runtime (tools, system prompt, streamText), streaming API routes (NDJSON), and admin UI chat extensions. Load for any internal…