Posts tagged "Ai-gateway"
-
OpenAI’s GPT-5.6 Sol, Luna, and Terra models are 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. The AI Gateway handles everything automatically. Here’s an example using the GPT-5.6 Sol model:
import OpenAI from 'openai';export default async () => {const openai = new OpenAI();const response = await openai.responses.create({model: 'gpt-5.6-sol',input: 'Give a concise explanation of how AI works.',});return Response.json(response);};GPT-5.6 Sol, Luna, and Terra 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.
-
Anthropic’s Claude Fable 5 model is once again available through Netlify’s AI Gateway 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 model:
import Anthropic from '@anthropic-ai/sdk';export default async () => {const anthropic = new Anthropic();const response = await anthropic.messages.create({model: 'claude-fable-5',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 is available for all Function types. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation.
-
Google’s Nano Banana 2 Lite (Gemini 3.1 Flash-Lite Image) is now available through AI Gateway. You can call this lightweight image generation model from Netlify Functions without configuring API keys; the AI Gateway provides the connection to Google for you.
Example usage in a Function:
import { GoogleGenAI } from '@google/genai';// Netlify Function: Generate an image with Gemini 3.1 Flash Lite Image and return it directly.// Usage (GET): /.netlify/functions/gemini-31-flash-lite-image?prompt=Your+prompt+here// Returns: binary image (PNG/JPEG/etc) with proper content-type. If no image, JSON error.export default async (request: Request) => {const url = new URL(request.url);const prompt = url.searchParams.get('prompt') || 'two happy bananas holding flashlights';const ai = new GoogleGenAI({});try {const response = await ai.models.generateContent({model: 'gemini-3.1-flash-lite-image',contents: prompt,config: {imageConfig: {aspectRatio: '16:9',imageSize: '1K'}}});let imagePart = null;for (const part of response.candidates[0].content.parts) {if (part.inlineData) {imagePart = part.inlineData;break;}}const bytes = Buffer.from(imagePart.data, 'base64');const mimeType = imagePart.mimeType || 'image/png';return new Response(bytes, {status: 200,headers: {'Content-Type': mimeType,'Cache-Control': 'no-store'}});} catch (err) {return new Response(JSON.stringify({ error: String(err), prompt }), {status: 500,headers: { 'Content-Type': 'application/json' }});}};Built for speed and lower cost, Gemini 3.1 Flash-Lite Image is a good fit for high-volume image generation. It works across any function type and is compatible with other Netlify primitives such as caching and rate limiting, giving you control over request behavior across your site.
Learn more in the AI Gateway documentation.
-
Anthropic’s Claude Sonnet 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 Sonnet 5 model:
import Anthropic from '@anthropic-ai/sdk';export default async () => {const anthropic = new Anthropic();const response = await anthropic.messages.create({model: 'claude-sonnet-5',max_tokens: 4096,messages: [{role: 'user',content: 'How can AI improve my coding?'}]});return Response.json(response);};Claude Sonnet 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.
-
Update — June 13, 2026
Anthropic has suspended access to Claude Fable 5. Requests to
claude-fable-5through Netlify AI Gateway will fail until access is restored.Anthropic’s Claude Fable 5 model is now available through Netlify’s AI Gateway 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 model:
import Anthropic from '@anthropic-ai/sdk';export default async () => {const anthropic = new Anthropic();const response = await anthropic.messages.create({model: 'claude-fable-5',max_tokens: 4096,messages: [{role: 'user',content: 'How can AI improve my cybersecurity?'}]});return new Response(JSON.stringify(response), {headers: { 'Content-Type': 'application/json' }});};Claude Fable 5 is available for all Function types. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation.
-
Anthropic’s Claude Opus 4.8 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 4.8 model:
import Anthropic from '@anthropic-ai/sdk';export default async () => {const anthropic = new Anthropic();const response = await anthropic.messages.create({model: 'claude-opus-4-8',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 Opus 4.8 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.5 Flash model is now available through Netlify’s AI Gateway 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.5 Flash model:
import { GoogleGenAI } from '@google/genai';export default async () => {const ai = new GoogleGenAI({});const response = await ai.models.generateContent({model: 'gemini-3.5-flash',contents: 'How can AI improve my coding?'});return Response.json(response);};Gemini 3.5 Flash is available for all Function types. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation.
-
Google’s Gemini 3.1 Flash-Lite model is now available through Netlify’s AI Gateway with zero configuration required. The Preview version of this model was available as of March 3, 2026.
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.1 Flash-Lite model:
import { GoogleGenAI } from '@google/genai';export default async () => {const ai = new GoogleGenAI({});const response = await ai.models.generateContent({model: 'gemini-3.1-flash-lite',contents: 'How can AI improve my coding?'});return Response.json(response);};Gemini 3.1 Flash-Lite is available for all Function types. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation.
-
OpenAI’s GPT-5.5 Instant model is now available through Netlify’s AI Gateway with zero configuration required.
Use the OpenAI SDK directly in your Netlify Functions without managing API keys or authentication. The AI Gateway handles everything automatically. Here’s an example using the GPT-5.5 Instant model:
import OpenAI from 'openai';export default async () => {const openai = new OpenAI();const response = await openai.responses.create({model: 'chat-latest',input: 'How does AI work?'});return Response.json(response);};Note: The model API name is
chat-latest.GPT-5.5 Instant is available for all Function types. You get automatic access to Netlify’s caching, rate limiting, and authentication infrastructure.
Learn more in the AI Gateway documentation.