Skip to content
Dashboard

AI Gateway supports OpenAI's Responses API

Link to headingWhat you can do

Link to headingGetting started

npm install openai

import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.AI_GATEWAY_API_KEY,
baseURL: 'https://ai-gateway.vercel.sh/v1',
});

Link to headingBasic example: text generation

const response = await client.responses.create({
model: 'openai/gpt-5.4',
input: 'What is the best restaurant in San Francisco?',
});

Link to headingStructured output with reasoning

const response = await client.responses.create({
model: 'anthropic/claude-sonnet-4.6',
input: 'Build a Next.js app with auth and a dashboard page.',
reasoning: { effort: 'high' },
text: {
format: {
type: 'json_schema',
name: 'app_plan',
strict: true,
schema: {
type: 'object',
properties: {
files: { type: 'array', items: { type: 'string' } },
summary: { type: 'string' },
},
required: ['files', 'summary'],
additionalProperties: false,
},
},
},
});