netlify-ai-gateway

netlify-ai-gateway is a skill for Claude Code from netlify/context-and-tools. It costs 154 tokens per session (3,559 once invoked), scanned C, original, MIT.

A Netlify service for calling OpenAI, Anthropic, Google Gemini, or OpenRouter models from server-side Functions or Edge Functions. Netlify Functions and Edge Functions are code that runs on Netlify's servers.

In plain words
What is it for?
Use it for request-time chat, text or image generation, and summarisation in a Netlify project.
Why use it?
It avoids managing separate provider credentials in the server code, while keeping model calls out of browser code.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the netlify-skills plugin — 16 skills, 1 MCP server shipped together

Good fit Use it for request-time chat, text or image generation, and summarisation in a Netlify project.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/netlify/context-and-tools/netlify-ai-gateway
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 netlify/context-and-tools --skill netlify-ai-gateway
Clone the repo
git clone --depth 1 https://github.com/netlify/context-and-tools

Made for: Claude Code.

Or install netlify-skills, the plugin that ships this one along with the rest of its 16 skills, 1 MCP server.

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 netlify-ai-gateway

README.md
[![agentmods](https://agentmods.dev/badge/skills/netlify/context-and-tools/netlify-ai-gateway/github.svg)](https://agentmods.dev/skills/netlify/context-and-tools/netlify-ai-gateway)
Your own site
<a href="https://agentmods.dev/skills/netlify/context-and-tools/netlify-ai-gateway"><img src="https://agentmods.dev/badge/skills/netlify/context-and-tools/netlify-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.

agentmods 80×15 button for netlify-ai-gateway

Your own site · 80×15
<a href="https://agentmods.dev/skills/netlify/context-and-tools/netlify-ai-gateway"><img src="https://agentmods.dev/badge/skills/netlify/context-and-tools/netlify-ai-gateway.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 154 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,559 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 4 Nov 2026
  • Snyk pass 3 Nov 2026
How audits are shown
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.00154 $0.03559
Opus 5.5 $0.00062 $0.01424
Sonnet 5.5 $0.00031 $0.00712
Haiku 4.5 $0.00015 $0.00356

Measured 9d ago against content hash abaebc8c6e78, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

netlify-ai-gateway scanned grade C with 1 finding 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.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- system: agent-context/ai-gateway/system.md — human-owned, merged by ctx-gen; edit system.md, not this section -->
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

agent-plugin/skills/netlify-ai-gateway/SKILL.md · 272 lines

How it starts

The opening of the file, as written. The whole thing — 272 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Netlify AI Gateway

Call AI models from Netlify compute using the provider's official SDK. The gateway injects provider credentials automatically — instantiate the SDK with no args and it works.

Use the provider SDK with injected env credentials. Do not hand-roll a raw fetch() against the gateway URL, and do not wire calls to NETLIFY_AI_GATEWAY_KEY / NETLIFY_AI_GATEWAY_URL as your default path — those are for third-party/unsupported libraries only (see below).

Footguns (read first)

  • Not browser-callable. Gateway calls belong in Functions or Edge Functions — never in client-side code. The browser has no injected credentials.
  • Runtime-only credentials. Never call the gateway from build scripts, prerender/SSG, or build plugins — those get no credentials and fail. Do AI work at request time; cache to Netlify Blobs if output must look precomputed.
  • 60-second sync timeout. A gateway call in a synchronous function is bound by the 60s function timeout. Stream long generations (SDK streaming + ReadableStream), or use a background function that persists output for the client to fetch. Never leave a slow generation unstreamed.
  • Requires one production deploy. The gateway does not activate until a project has at least one production deploy. Even for local dev, run netlify deploy --prod once first.
  • Don't hardcode model lists. Available models change. Check the live providers endpoint (https://api.netlify.com/api/v1/ai-gateway/providers/detailed) rather than baking in a static list. That endpoint lists models — it is not where AI requests are sent.
  • OpenRouter SDK needs 1.2.43+. Earlier versions ignore OPENROUTER_BASE_URL, call openrouter.ai directly, and fail with 401 Missing Authentication header.

Where code goes

Write normal Function/handler code — there is no AI-specific file type. A function at netlify/functions/joke.js exporting config = { path: "/api/joke" } is served at /api/joke under both netlify dev and production.

Read the full file on GitHub · 272 lines

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. 9d ago Changed · +2 lines abaebc8c6e78
  2. 1mo ago Changed 9eab383d64c9
  3. 2mo ago Changed · +69 lines · +19 tokens per session 5bb82e44e594
  4. 3mo ago First seen · 201 lines · 135 tokens per session scan C e848053729b1

Subscribe to this mod's changes

netlify-ai-gateway is a skill published in the GitHub repository netlify/context-and-tools (58 stars, last pushed yesterday), licensed MIT. It adds 154 tokens to every session and 3,559 once invoked, about $0.0006 per session on Opus 5.5. A static security scan graded it C with 1 finding (hidden instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

netlify-ai-gateway compared with skills from other repositories

netlify-ai-gateway next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
netlify-ai-gatewaynetlify/context-and-toolsSkill58yesterdayMITC154Claude Code
open-sourcebrowser-use/browser-useSkill123ktodayMITA101Claude Code
gemini-api-agent-platformdavila7/claude-code-templatesSkill35ktodayMITA61Claude Code, Codex
prowler-mcpprowler-cloud/prowlerSkill15ktodayApache-2.0A67Claude Code
gemini-api-devgoogle-gemini/gemini-skillsSkill5.1ktodayApache-2.0A96Claude Code
deepstream-sopNVIDIA/skillsSkill4.3ktodayApache-2.0A219Claude Code
tao-run-inference-serviceNVIDIA/skillsSkill4.3ktodayApache-2.0A92Claude Code