AI Engineer Guide

How to use OpenAI's GPT-5 API for free

Vercel’s AI Gateway is a unified interface for interacting with multiple LLMs across different providers.

Right now, you can get access to more than 150+ LLM models from them.

Apparently, they’re providing $5 per month free credit which you can use to try any LLM model including OpenAI’s GPT-5

2025-08-28-at-00.13.492x.png

How to get started?

Get your API key for AI Gateway from your Vercel Dashboard..

Once you have the key, you can set the base URL and API key in an SDK that supports OpenAI, or you can directly interact with it via cURL.

SettingValueNotes
baseURLhttps://ai-gateway.vercel.sh/v1Use this as the API base URL
apiKey$AI_GATEWAY_API_KEYReplace AI_GATEWAY_API_KEY with API Key

Supported GPT 5 Models

Currently these are the GPT-5 family models that are supported in Vercel AI Gateway

Model NameModel IDContextInput TokensOutput TokensCache ReadGood At
GPT-5openai/gpt-5400K$1.25/M$10.00/M$0.13/MComplex reasoning, broad real-world knowledge, code-intensive, and multi-step agentic tasks
GPT-5 nanoopenai/gpt-5-nano400K$0.05/M$0.40/M$0.01/MHigh throughput, excels at simple instruction or classification tasks
GPT-5 miniopenai/gpt-5-mini400K$0.25/M$2.00/M$0.03/MCost optimized, excels at reasoning/chat tasks with balance of speed, cost, and capability

Example

cURL

curl -X POST "https://ai-gateway.vercel.sh/v1/chat/completions" \
-H "Authorization: Bearer $AI_GATEWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
  "model": "openai/gpt-5",
  "messages": [
    {
      "role": "user",
      "content": "Why is the sky blue?"
    }
  ],
  "stream": false
}'

OpenAI SDK

import os
from openai import OpenAI

client = OpenAI(
  api_key=os.getenv('AI_GATEWAY_API_KEY'),
  base_url='https://ai-gateway.vercel.sh/v1'
)

response = client.chat.completions.create(
  model='openai/gpt-5',
  messages=[
    {
      'role': 'user',
      'content': 'Why is the sky blue?'
    }
  ]
)

Replace the model id with whatever model that you want to use.

Happy building-with AI!

#Openai #Vercel #Ai-Gateway

Stay Updated

Get the latest AI engineering insights delivered to your inbox.

No spam. Unsubscribe at any time.