Posts tagged "Ai-gateway"
-
OpenAI’s ChatGPT Images 2.5 models are now available through Netlify’s AI Gateway and Agent Runners with zero configuration required. Use
gpt-image-2.5-flareorgpt-image-2.5-sunburstto generate images for your applications.Use the OpenAI SDK directly in your Netlify Functions without managing API keys or authentication. AI Gateway handles everything automatically. Here’s an example using the
gpt-image-2.5-flaremodel:import OpenAI from 'openai';const ai = new OpenAI();export default async (req, context) => {const response = await ai.images.generate({model: 'gpt-image-2.5-flare',prompt: 'A golden retriever working at a laptop in a sunny startup office',size: '1024x1024',quality: 'low',output_format: 'jpeg',output_compression: 80});const imageBuffer = Buffer.from(response.data[0].b64_json, 'base64');return new Response(imageBuffer, {status: 200,headers: {'content-type': 'image/jpeg','cache-control': 'no-store'}});};Both ChatGPT Images 2.5 models are available across standard Functions, Background Functions, Scheduled Functions, Edge Functions, and Agent Runners. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation and Agent Runners documentation.
-
OpenAI’s GPT-6 Astra model is now available through Netlify’s AI Gateway and Agent Runners with zero configuration required.
Use the OpenAI SDK directly in your Netlify Functions without managing API keys or authentication. AI Gateway handles everything automatically. Here’s an example using GPT-6 Astra with the Responses API:
import OpenAI from 'openai';export default async () => {const openai = new OpenAI();const response = await openai.responses.create({model: 'gpt-6-astra',input: 'Give a concise explanation of how AI works.',});return Response.json(response);};GPT-6 Astra is also available across Background Functions, Scheduled Functions, and Edge Functions. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation and Agent Runners documentation.
-
Google’s Gemini 3.8 Flash model is now available through Netlify’s AI Gateway and Agent Runners with zero configuration required.
Use the Google GenAI SDK directly in your Netlify Functions without managing API keys or authentication. The AI Gateway handles everything automatically. Here’s an example using the Gemini 3.8 Flash model:
import { GoogleGenAI } from '@google/genai';export default async () => {const ai = new GoogleGenAI({});const response = await ai.models.generateContent({model: 'gemini-3.8-flash',contents: 'How can AI improve my coding?'});return Response.json(response);};Gemini 3.8 Flash is available for all Function types and Agent Runners. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation and Agent Runners documentation.
-
Anthropic’s Claude Fable 5.1 model is now available through Netlify’s AI Gateway and Agent Runners with zero configuration required.
Use the Anthropic SDK directly in your Netlify Functions without managing API keys or authentication. The AI Gateway handles everything automatically. Here’s an example using the Claude Fable 5.1 model:
import Anthropic from '@anthropic-ai/sdk';export default async () => {const anthropic = new Anthropic();const response = await anthropic.messages.create({model: 'claude-fable-5-1',max_tokens: 4096,messages: [{role: 'user',content: 'How can AI improve my coding?'}]});return new Response(JSON.stringify(response), {headers: { 'Content-Type': 'application/json' }});};Claude Fable 5.1 is available for all Function types and Agent Runners. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation and Agent Runners documentation.
-
Google’s Gemini 3.7 Flash model is now available through Netlify’s AI Gateway and Agent Runners with zero configuration required.
Use the Google GenAI SDK directly in your Netlify Functions without managing API keys or authentication. The AI Gateway handles everything automatically. Here’s an example using the Gemini 3.7 Flash model:
import { GoogleGenAI } from '@google/genai';export default async () => {const ai = new GoogleGenAI({});const response = await ai.models.generateContent({model: 'gemini-3.7-flash',contents: 'How can AI improve my coding?'});return Response.json(response);};Gemini 3.7 Flash is available for all Function types and Agent Runners. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation and Agent Runners documentation.
-
The AI Gateway now supports OpenRouter, giving you access to models from providers beyond Netlify’s direct integrations (OpenAI, Anthropic, Google Gemini).
This partnership opens up models from providers like DeepSeek, Meta, Mistral, Qwen, and xAI, all billed through your existing Netlify credits.
Learn more about our OpenRouter partnership through the Netlify blog on open models.
Supported models
For a full list of models available on OpenRouter, visit OpenRouter’s models page.
Note that Netlify only allows requests through OpenRouter for model providers that support a Zero Data Retention (ZDR) policy, meaning your prompts and outputs are never stored nor trained on. Models on OpenRouter that do not have any available provider guaranteeing this policy (at the time of your request) are not available via Netlify.
Set up OpenRouter for AI Gateway
As with the other providers, Netlify automatically injects
OPENROUTER_API_KEYandOPENROUTER_BASE_URLinto your Netlify Functions, Edge Functions, and Preview Server (unless you’ve already set your own values for either).You can call an OpenRouter-served model using whichever client you prefer:
- OpenRouter SDK (
@openrouter/sdk): passOPENROUTER_BASE_URLexplicitly asserverURLwhen constructing the client, this is the one exception where the base URL isn’t picked up automatically. - OpenAI SDK: works out of the box, no extra config. Just pass a model ID in OpenRouter notation (e.g.
deepseek/deepseek-v4-flash-0731). - REST API: call
${OPENROUTER_BASE_URL}/chat/completionswith a bearer token fromOPENROUTER_API_KEY.
Whichever client you use, you can find model IDs to pass in the OpenRouter models directory.
Note that a model listed in OpenRouter’s directory will not work through the AI Gateway if it does not support a Zero Data Retention (ZDR) policy since Netlify only routes to OpenRouter providers with this support.
To learn more about using AI Gateway, check out our official AI Gateway Netlify docs.
- OpenRouter SDK (
-
GPT-5.6 Luna now costs 80% less and GPT-5.6 Terra is 20% less through Netlify AI Gateway, making both models more cost-efficient for production AI workloads.
These reductions improve the price-performance tradeoff across the GPT-5.6 model family, giving teams more flexibility to choose the right balance of capability and cost for each workload.
Learn more in OpenAI’s announcement, Advancing the price-performance frontier with GPT-5.6.
-
Anthropic’s Claude Opus 5 model is now available through Netlify’s AI Gateway and Agent Runners with zero configuration required.
Use the Anthropic SDK directly in your Netlify Functions without managing API keys or authentication. The AI Gateway handles everything automatically. Here’s an example using the Claude Opus 5 model:
import Anthropic from '@anthropic-ai/sdk';export default async () => {const anthropic = new Anthropic();const response = await anthropic.messages.create({model: 'claude-opus-5',max_tokens: 4096,output_config: { effort: 'medium' },messages: [{role: 'user',content: 'How can AI improve my coding?'}]});return new Response(JSON.stringify(response), {headers: { 'Content-Type': 'application/json' }});};Claude Opus 5 is available for all Function types and Agent Runners. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation and Agent Runners documentation.
-
Google’s Gemini 3.6 Flash and Gemini 3.5 Flash-Lite models are now available through Netlify’s AI Gateway and Agent Runners with zero configuration required.
Use the Google GenAI SDK directly in your Netlify Functions without managing API keys or authentication. The AI Gateway handles everything automatically. Here’s an example using the Gemini 3.6 Flash model:
import { GoogleGenAI } from '@google/genai';export default async () => {const ai = new GoogleGenAI({});const response = await ai.models.generateContent({model: 'gemini-3.6-flash',contents: 'How can AI improve my coding?',});return Response.json(response);};Gemini 3.6 Flash and Gemini 3.5 Flash-Lite are available for all Function types and Agent Runners. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation and Agent Runners documentation.