← Prompts
Reference / Understand Instructa AI Prompts

Guidelines for installing and configuring Fal.AI

Guidelines for installing and configuring Fal.ai

# Install & Configure Fal.ai for Text-to-Image

## Overview

1. Install Fal.ai client (@fal-ai/client) and server proxy (@fal-ai/server-proxy).
2. Create a Next.js API route that forwards requests to Fal.ai, hiding your API key.
3. Store the Fal.ai key in environment variables.

## CRITICAL INSTRUCTIONS
- Never expose the FAL_KEY in client code.
- Use the @fal-ai/server-proxy/nextjs route to protect the key.
- Confirm your .env.local (and Vercel env) hold FAL_KEY.

## Key Steps

1. Install:
   ```bash
   npm install @fal-ai/client @fal-ai/server-proxy
   ```
2. Environment (.env.local):
   ```bash
   FAL_KEY="your-secret-fal-ai-key"
   ```
3. Create Proxy Route (app/api/fal/proxy/route.ts):
   ```ts

Sign in to view the full prompt.

Sign In

Classification

Reference Documentation, cheatsheets, setup guides
Reference Understand
Explain or analyze
Scope Project
This codebase
Manual Manually placed / Persistent