Help me set up AI Gateway in this project.
1. Install dependencies:
npm install ai
2. Pull Vercel environment variables locally:
vc env pull .env.local
This pulls VERCEL_OIDC_TOKEN, so no AI Gateway API key is needed.
3. Create an index.mjs file:
import { streamText } from 'ai'
const result = streamText({
model: 'openai/gpt-5.5',
prompt: 'Explain quantum computing in simple terms.',
})
for await (const chunk of result.textStream) {
process.stdout.write(chunk)
}
4. Run the script:
node --env-file=.env.local index.mjs
1
2
3
4
5
6
import { streamText } from'ai'const result = streamText({
model: 'openai/gpt-5.5',
prompt: 'Why is the sky blue?'
})