Vercel AI Gateway 403 RestrictedModelsError when using free credits

When attempting to use the Vercel AI Gateway Chat Completions endpoint with the openai Python SDK, requests are failing with a 403 RestrictedModelsError. The error message states that free credits temporarily have restricted access due to abuse.

Running a Python script that sends a base64 image to the AI Gateway results in an immediate crash. The API returns a 403 status code with the following JSON error and provider metadata:

Error:

{
  "error": {
    "message": "Free credits temporarily have restricted access due to abuse. We are working on a resolution. Paid credits continue to have unrestricted access.",
    "type": "no_providers_available",
    "param": {
      "statusCode": 403,
      "name": "RestrictedModelsError"
    }
  },
  "providerMetadata": {
    "gateway": {
      "routing": {
        "originalModelId": "google/gemini-3-flash",
        "resolvedProvider": "vertex",
        "resolvedProviderApiModelId": "gemini-3-flash-preview"
      }
    }
  }
}

Expected Behavior

The AI Gateway should successfully route the prompt and image payload to the requested model (e.g., google/gemini-3-flash or other compatible vision models), process the completion, and return the generated text response without blocking the request.

Steps to Reproduce

  1. Configure the openai Python SDK to use the Vercel AI Gateway base URL (https://ai-gateway.vercel.sh/v1).
  2. Authenticate using a Vercel AI Gateway API key on a free tier (Hobby) account.
  3. Call the client.chat.completions.create endpoint, passing a system prompt and a base64-encoded image URL.
  4. Execute the script and observe the 403 error response.

Code Configuration

Here is the isolated function (from my script) used to make the API call:

from openai import OpenAI

def get_ai_filename(base64_img, gateway_url, api_key, model_name):
    client = OpenAI(
        api_key=api_key,
        base_url=gateway_url  # https://ai-gateway.vercel.sh/v1
    )
    
    prompt = "Describe this image in 2 to 5 words to be used as a filename."
    
    completion = client.chat.completions.create(
        model=model_name, # User input: google/gemini-3-flash
        messages=[
            {
                "role": "user",
                "content": [
                    {"type": "text", "text": prompt},
                    {
                        "type": "image_url",
                        "image_url": {
                            "url": f"data:image/jpeg;base64,{base64_img}",
                            "detail": "auto"
                        }
                    }
                ]
            }
        ],
        max_tokens=30,
        temperature=0.3,
        stream=False
    )
    return completion.choices[0].message.content.strip()

Environment

Below are my environment details (I’m running this in a Codespace).

==================================================
ENVIRONMENT DETAILS REPORT
Generated on: 2026-04-13 13:38:26
==================================================

--- SYSTEM INFO ---
Os                       : Linux
Os Release               : 6.8.0-1044-azure
Os Version               : #50~22.04.1-Ubuntu SMP Wed Dec  3 15:13:22 UTC 2025
Machine Architecture     : x86_64
Processor                : x86_64
Node Name                : [REDACTED - NO PII]

--- PYTHON INFO ---
Version                  : 3.12.1 (main, Nov 27 2025, 10:47:52) [GCC 13.3.0]
Executable Path          : /home/codespace/.python/current/bin/python
Compiler                 : GCC 13.3.0
Build                    : ('main', 'Nov 27 2025 10:47:52')

--- NETWORK INFO ---
Hostname                 : [REDACTED - NO PII]
Local Ip                 : [REDACTED - NO PII]

--- ENVIRONMENT VARIABLES ---
Not included by user choice.

Hey, Alex! Welcome to the Vercel Community :waving_hand:

Appreciate your thorough post! :slight_smile:

The 403 RestrictedModelsError issue when using AI Gateway with free credits is a temporary restriction that we’ve put in placed for free tier users due to abuse prevention.

"message": "Free credits temporarily have restricted access due to abuse. We are working on a resolution. Paid credits continue to have unrestricted access.",

This error message you see is accurate.

To resolve this, you’ll need to go to AI Gateway credits and purchase credits which will automatically move you to the paid tier. This should then give you full access!

These docs may be helpful:

Thanks for the quick reply!

Is there any way you might know when this restriction might be lifted? I can’t really afford to purchase credits (I’m a hobbyist, researcher, and high school student) so I’d like to know when I can expect the Gateway to be up and running again for Hobby tier users. If not, I understand—I’ve worked with some tech companies before that weren’t super clear won their policies with support staff :face_with_bags_under_eyes:—but based on my experience I think even a little bit of downtime with this platform is worth the benefits that Vercel provides.

Again, thanks for reaching out. I hope to hear from you soon!