Create Your Application
Create your Expo application and install dependencies
Create Your Application
Start by creating a new Expo application. This command will create a new directory named my-ai-app and set up a basic Expo application inside it.
pnpm create expo-app@latest my-ai-appNavigate to the newly created directory:
cd my-ai-appInstall dependencies
Install ai and @ai-sdk/react, the AI package and AI SDK's React hooks. The AI SDK's Vercel AI Gateway provider ships with the ai package. You'll also install zod, a schema validation library used for defining tool inputs.
This guide uses the Vercel AI Gateway provider so you can access hundreds of models from different providers with one API key, but you can switch to any provider or model by installing its package. Check out available AI SDK providers for more information.
pnpm add ai @ai-sdk/react zodConfigure your AI Gateway API key
Create a .env.local file in your project root and add your AI Gateway API key. This key authenticates your application with the Vercel AI Gateway.
touch .env.localEdit the .env.local file:
AI_GATEWAY_API_KEY=xxxxxxxxxReplace xxxxxxxxx with your actual Vercel AI Gateway API key.
The AI SDK's Vercel AI Gateway Provider will default to using the
AI_GATEWAY_API_KEY environment variable.