netlify-ai-gateway

Route OpenAI, Anthropic, and Gemini SDK calls through Netlify's managed AI Gateway proxy.

Updated Jul 16, 2026
One-click install
npx skills add https://github.com/JamesMitofsky/tag-archive --skill netlify-ai-gateway-jamesmitofsky
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: netlify-ai-gateway
Source: https://github.com/JamesMitofsky/tag-archive/tree/main/.claude/skills/netlify-ai-gateway
Command: npx skills add https://github.com/JamesMitofsky/tag-archive --skill netlify-ai-gateway-jamesmitofsky

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires openai, @anthropic-ai/sdk, @google/genai.

What problem does it solve? Adding AI features to a Netlify site normally means managing provider API keys, choosing compatible models, and debugging gateway errors. This Skill provides the reference for using Netlify AI Gateway, which proxies OpenAI, Anthropic, and Google Gemini SDK calls without you holding any provider keys. ## Core Features & Use Cases - Keyless SDK setup: Construct new OpenAI(), new Anthropic(), or new GoogleGenAI() with no arguments; Netlify auto-injects the gateway base URL and placeholder key. - Curated model list: A verified list of supported chat, reasoning, and image models, since the gateway exposes only a subset of each provider's catalog. - Image generation via Gemini: Text-to-image and image-to-image editing through generateContent, returning base64 inlineData (OpenAI image models are not routed). - Production constraints: Guidance on the first-deploy requirement, credit metering, runtime-only credentials, the 60-second function timeout, and streaming or background-function mitigations. - Use Case: Build a /api/chat Netlify Function that calls gpt-4o-mini through the gateway, streams the response to the browser, and never touches a real API key. ## Quick Start Add an AI chat endpoint to my Netlify site using the AI Gateway with the OpenAI SDK and deploy it so the gateway activates.

Frequently Asked Questions about netlify-ai-gateway

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use the OpenAI SDK with Netlify AI Gateway?

Install the openai package and construct it bare with new OpenAI(). Netlify auto-injects OPENAI_BASE_URL and a placeholder OPENAI_API_KEY, which the SDK reads from the environment, so no constructor arguments or manual keys are needed.

Which models are available on Netlify AI Gateway?

The gateway exposes a curated subset, not every provider model. It includes Anthropic Claude Haiku/Sonnet/Opus variants, OpenAI gpt-4o through gpt-5.5 plus o-series reasoning models, and Gemini chat and image models like gemini-2.5-flash and gemini-3.1-flash-image.

Can I generate images with OpenAI models through Netlify AI Gateway?

No. Image generation on the gateway is Gemini-only, using models like gemini-2.5-flash-image or gemini-3.1-flash-image via the @google/genai SDK. OpenAI image models such as gpt-image-1 and dall-e are not routed through the gateway.

Why does Netlify AI Gateway return API key missing errors locally?

The gateway only activates after at least one production deploy, and local dev requires the directory to be linked to the Netlify site via netlify link. A brand-new or unlinked project gets no injected credentials, so gateway calls fail until you deploy and link.

What happens when a long AI generation exceeds the Netlify function timeout?

Synchronous functions are terminated after 60 seconds, so long completions or image renders may be cut off. Stream the response with a ReadableStream for interactive use, or use a background function (up to 15 minutes) that persists results to Netlify Blobs.

Can browser JavaScript call Netlify AI Gateway directly?

No. Gateway credentials are injected only into server-side runtime compute; there is no browser-callable endpoint. Proxy through a Netlify Function that the browser fetches, and never expose a provider API key in client code.