Skip to main content
Viber requires several API keys and configuration values to function. This guide explains each environment variable and how to obtain the necessary credentials.

Required environment variables

These environment variables must be set for Viber to run:

Gemini API key

GEMINI_API_KEY=your_gemini_api_key_here
Used for the AI code generation agent. Get your API key from Google AI Studio.

Daytona sandbox API key

DAYTONA_API_KEY=your_daytona_api_key_here
Required for creating and managing sandboxed development environments where generated code runs.
In the source code, this variable is referenced as SANDBOX_API_KEY in some deployment examples, but the actual environment variable name is DAYTONA_API_KEY as defined in src/lib/env/env.server.ts.

Unsplash API credentials

UNSPLASH_ACCESS_KEY=your_unsplash_access_key
UNSPLASH_SECRET_KEY=your_unsplash_secret_key
Viber translates AI-generated image descriptions into real images using Unsplash. Create an app at Unsplash Developers to get your keys.

Optional environment variables

These variables enable additional features but are not required for basic functionality:

ElevenLabs voice agent

ELEVENLABS_API_KEY=your_elevenlabs_api_key
VITE_ELEVENLABS_AGENT_ID=your_agent_id
The VITE_ELEVENLABS_AGENT_ID variable is a client-side environment variable that gets compiled into the frontend during build. If you change this value, you must rebuild the application.
Required only if you want to enable voice interaction mode. Get your credentials from ElevenLabs.

AI model configuration

DEFAULT_MODEL=gemini-3-pro
Specifies which Gemini model to use. Available options:
  • gemini-3-pro (default)
  • gemini-3-flash
  • gemini-2.0-flash
  • gemini-2.5-flash
  • gemini-2.5-pro

Image CDN base URL

IMAGE_CDN_BASE_URL=https://your-app-domain.com
Useful when the sandbox needs a public origin for image URLs.
In development, you can point this to your ngrok or forwarded URL. In production, set it to your public app domain or leave undefined to use relative /images paths.From src/lib/env/env.server.ts:48:
// Image CDN base URL (for LLM-generated image src)
// In development, point this to your ngrok/forwarded URL for this app.
// In production, set it to your public app domain or leave undefined to use relative /images.
IMAGE_CDN_BASE_URL: optionalEnv("IMAGE_CDN_BASE_URL"),

Creating your .env file

1

Create the file

In your project root, create a .env file:
touch .env
2

Add required variables

Add all required environment variables:
GEMINI_API_KEY=your_gemini_api_key_here
DAYTONA_API_KEY=your_daytona_api_key_here
UNSPLASH_ACCESS_KEY=your_unsplash_access_key
UNSPLASH_SECRET_KEY=your_unsplash_secret_key
3

Add optional variables

Include any optional variables you need:
# Optional: Voice mode
ELEVENLABS_API_KEY=your_elevenlabs_api_key
VITE_ELEVENLABS_AGENT_ID=your_agent_id

# Optional: Custom model
DEFAULT_MODEL=gemini-2.5-pro

# Optional: Image CDN
IMAGE_CDN_BASE_URL=https://your-app.com
4

Verify configuration

Start the development server to verify your configuration:
bun run dev
The app will throw an error if any required variables are missing.

Environment variable reference

Here’s the complete environment variable structure from src/lib/env/env.server.ts:25-49:
export const appEnv = {
  // Runtime Environment
  APP_ENV: resolveAppEnv(),

  // AI Configuration
  GEMINI_API_KEY: requireEnv("GEMINI_API_KEY"),
  DEFAULT_MODEL: optionalEnv("DEFAULT_MODEL", "gemini-3-pro"),

  // Sandbox Configuration
  DAYTONA_API_KEY: requireEnv("DAYTONA_API_KEY"),

  // ElevenLabs Voice Agent
  ELEVENLABS_API_KEY: optionalEnv("ELEVENLABS_API_KEY"),
  ELEVENLABS_AGENT_ID: optionalEnv("VITE_ELEVENLABS_AGENT_ID"),

  // Unsplash
  UNSPLASH_ACCESS_KEY: requireEnv("UNSPLASH_ACCESS_KEY"),
  UNSPLASH_SECRET_KEY: requireEnv("UNSPLASH_SECRET_KEY"),

  // Image CDN base URL
  IMAGE_CDN_BASE_URL: optionalEnv("IMAGE_CDN_BASE_URL"),
} as const;
Never commit your .env file to version control. It should already be included in .gitignore.

Build docs developers (and LLMs) love