Menu
Important
Stay updated on React2Shell

Getting Started

Last updated December 1, 2025

This quickstart will walk you through making an AI model request with Vercel's AI Gateway. While this guide uses the AI SDK, you can also integrate with the OpenAI SDK or other community frameworks.

  1. Start by creating a new directory using the command. Change into your new directory and then run the command, which will create a .

  2. Install the AI SDK package, , along with other necessary dependencies.

    is used to access environment variables (your AI Gateway API key) within your application. The package is a TypeScript runner that allows you to run your TypeScript code. The package is the TypeScript compiler. The package is the TypeScript definitions for the Node.js API.

  3. To create an API key, go to the AI Gateway tab of the dashboard:

    1. Select API keys on the left side bar
    2. Then select Create key and proceed with Create key from the dialog

    Once you have the API key, create a file and save your API key:

    Instead of using an API key, you can use OIDC tokens to authenticate your requests.

    The AI Gateway provider will default to using the environment variable.

  4. Create an file in the root of your project and add the following code:

    Now, run your script:

    You should see the AI model's response to your prompt.

  5. Continue with the AI SDK documentation to learn advanced configuration, set up provider and model routing with fallbacks, and explore more integration examples.

The AI Gateway provides OpenAI-compatible API endpoints that allow you to use existing OpenAI client libraries and tools with the AI Gateway.

The OpenAI-compatible API includes:

  • Model Management: List and retrieve the available models
  • Chat Completions: Create chat completions that support streaming, images, and file attachments
  • Tool Calls: Call functions with automatic or explicit tool selection
  • Existing Tool Integration: Use your existing OpenAI client libraries and tools without needing modifications

Learn more about using the OpenAI SDK with the AI Gateway in the OpenAI-Compatible API page.

The AI Gateway is designed to work with any framework that supports the OpenAI API or AI SDK 5.

Read more about using the AI Gateway with other community frameworks in the framework integrations section.


Was this helpful?

supported.