> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anotherwrapper.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Replicate

> Set up Replicate & understand how it's used throughout the app

Replicate is your go-to for file-heavy AI workflows in this repo -- image generation, video generation, and audio transcription. Unlike the chat providers that stream text, Replicate handles longer-running jobs and model-specific workflows cleanly.

## Get your API key

<Steps>
  <Step title="Create or sign into your Replicate account">
    Head to [Replicate](https://replicate.com/signin) and sign up or log in.
  </Step>

  <Step title="Generate an API token">
    Go to the [API tokens page](https://replicate.com/account/api-tokens) and click **Create token**.
  </Step>

  <Step title="Add it to your env">
    Paste the token in your `.env.local` file:

    ```env theme={null}
    REPLICATE_API_TOKEN=your_replicate_api_key
    ```
  </Step>
</Steps>

<Warning>
  Save your API token somewhere safe right away. You won't be able to see it again after creation.
</Warning>

## Apps using Replicate

Replicate powers several of the media and file-processing flows in the app.

<CardGroup cols={3}>
  <Card title="Video Studio" icon="video" href="/apps/video-studio">
    Generate AI videos with progress tracking via Replicate
  </Card>

  <Card title="Image Studio" icon="image-polaroid" href="/apps/image-studio">
    Generate images using Flux and other models on Replicate
  </Card>

  <Card title="Audio" icon="file-audio" href="/apps/audio">
    Transcribe recordings with Replicate Whisper
  </Card>
</CardGroup>

## Features

Here's what Replicate brings to the table:

* **Async generation** -- long-running media tasks are submitted and processed with progress tracking
* **Video Studio** -- all shipped video models currently route through the Replicate integration
* **Image Studio** -- access image generation models like Flux
* **Audio** -- run Whisper transcription on uploaded recordings
* **Cloud storage** -- generated media is automatically uploaded to cloud storage
* **Database tracking** -- generation data is stored in the `generations` table in PostgreSQL
* **Credit usage** -- each generation reduces the user's credits (configurable in `toolConfig.ts`)

## How it works

Unlike chat providers that use the shared text-model registry, Replicate handles media generation and transcription workflows through dedicated integrations.

Here's the typical flow for a generation request:

1. You submit a prompt and configuration from the front-end
2. The request is sent to Replicate to start async generation
3. Progress is tracked and reported back in real-time
4. Once complete, the generated media or transcript is retrieved
5. The media is uploaded to cloud storage
6. Results are stored in PostgreSQL

<Info>
  The key difference from chat providers: Replicate tasks can take seconds to minutes, so everything runs asynchronously with progress updates instead of token-by-token streaming.
</Info>

<Card title="Structure" icon="folder" href="/setup/structure">
  Understand the full project structure of the codebase.
</Card>
