Skip to content
Docs

OIDC

The Vercel OIDC token is a way to authenticate your requests to the AI Gateway without needing to manage an API key. Vercel automatically generates the OIDC token that it associates with your Vercel project.

Vercel OIDC tokens are only valid for 12 hours, so you will need to refresh them periodically during local development. You can do this by running vercel env pull again.

  1. Before you can use the OIDC token during local development, ensure that you link your application to a Vercel project:

    terminal
    vercel link
  2. Pull the environment variables from Vercel to get the OIDC token:

    terminal
    vercel env pull
  3. With OIDC authentication, you can directly use the gateway provider without needing to obtain an API key or set it in an environment variable:

    app/api/chat/route.ts
    import { generateText } from 'ai';
     
    export async function GET() {
      const result = await generateText({
        model: 'spacexai/grok-4.5',
        prompt: 'Why is the sky blue?',
      });
      return Response.json(result);
    }
Last updated August 24, 2026

Was this helpful?

supported.