Posts tagged "Ai-gateway"

Subscribe to feed
  • Google Gemini 3.7 Flash now available in AI Gateway and Agent Runners

    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.

    Permalink to Google Gemini 3.7 Flash now available in AI Gateway and Agent Runners
  • AI Gateway adds OpenRouter support for more AI model choice

    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_KEY and OPENROUTER_BASE_URL into 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): pass OPENROUTER_BASE_URL explicitly as serverURL when 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/completions with a bearer token from OPENROUTER_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.

    Permalink to AI Gateway adds OpenRouter support for more AI model choice
  • GPT-5.6 Luna and Terra price reduction on AI Gateway

    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.

    Permalink to GPT-5.6 Luna and Terra price reduction on AI Gateway
  • Claude Opus 5 Now Available in AI Gateway and Agent Runners

    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.

    Permalink to Claude Opus 5 Now Available in AI Gateway and Agent Runners
  • Google Gemini 3.6 Flash and Gemini 3.5 Flash-Lite Now Available in AI Gateway and Agent Runners

    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.

    Permalink to Google Gemini 3.6 Flash and Gemini 3.5 Flash-Lite Now Available in AI Gateway and Agent Runners
  • OpenAI GPT-5.6 Sol, Luna, and Terra Now Available in AI Gateway and Agent Runners

    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.

    Permalink to OpenAI GPT-5.6 Sol, Luna, and Terra Now Available in AI Gateway and Agent Runners
  • Claude Fable 5 reactivated in AI Gateway

    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.

    Permalink to Claude Fable 5 reactivated in AI Gateway
  • Claude Sonnet 5 now available in AI Gateway and Agent Runners

    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.

    Permalink to Claude Sonnet 5 now available in AI Gateway and Agent Runners
  • Nano Banana 2 Lite (Gemini 3.1 Flash-Lite Image) is now available in AI Gateway.

    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.

    Permalink to Nano Banana 2 Lite (Gemini 3.1 Flash-Lite Image) is now available in AI Gateway.
Next page