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

# AI Content Generation Guide

> Generate images, videos, audio, and 3D models using AI

## Overview

Junis integrates with Replicate AI to provide powerful content generation capabilities. Create images, videos, audio, and 3D models through natural language prompts.

<Info>
  Content generation consumes credits based on the model used and processing time. Check your credit balance before generating.
</Info>

***

## Supported Content Types

<CardGroup cols={4}>
  <Card title="Images" icon="image">
    SDXL, Flux, and more
  </Card>

  <Card title="Videos" icon="video">
    AI video generation
  </Card>

  <Card title="Audio" icon="music">
    Music and sound effects
  </Card>

  <Card title="3D Models" icon="cube">
    GLB format models
  </Card>
</CardGroup>

***

## Generating Content

### Through Chat

Ask your AI agent to generate content using natural language:

```
"Generate an image of a sunset over mountains"
"Create a 10-second video of ocean waves"
"Make background music for a podcast intro"
```

### Through Team Content Page

1. Navigate to **Team > Content**
2. View all generated content for your organization
3. Filter by type, status, or date
4. Retry failed generations or delete content

***

## Content Status

| Status       | Description                        |
| ------------ | ---------------------------------- |
| `pending`    | Waiting to be processed            |
| `processing` | Generation in progress             |
| `completed`  | Successfully generated             |
| `failed`     | Generation failed (can be retried) |

<Note>
  Processing time varies by content type. Images typically complete in 10-30 seconds, while videos may take several minutes.
</Note>

***

## Managing Content

### Viewing Content

From the Team Content page, you can:

* **Preview** generated content directly in the browser
* **Download** content to your device
* **View details** including prompt, model used, and processing time

### Retrying Failed Content

If content generation fails:

1. Find the failed item in the content list
2. Click **Retry**
3. The system will attempt to regenerate the content

### Deleting Content

To remove content:

1. Select the content item
2. Click **Delete**
3. Confirm the deletion

<Warning>
  Deleted content cannot be recovered. Storage space is freed immediately.
</Warning>

***

## Technical Details

<Info>
  This section is for administrators and developers who need to understand how the `generate_content` tool works internally.
</Info>

### Tool Parameters

The `gen_content` tool accepts the following parameters:

| Parameter      | Type    | Required | Description                                                             |
| -------------- | ------- | -------- | ----------------------------------------------------------------------- |
| `version`      | string  | **Yes**  | Replicate model identifier (e.g., `stability-ai/sdxl`)                  |
| `input_values` | object  | **Yes**  | Model-specific input parameters (must include `prompt` for most models) |
| `prefer_wait`  | boolean | No       | Wait for completion inline (default: `false`)                           |

### Generation Modes

<Tabs>
  <Tab title="Async Mode (Default)">
    **`prefer_wait=false`** - Queue and return immediately

    The task is queued in the background via Celery workers. This is the default mode when generating content through chat.

    **Return Structure:**

    ```json theme={null}
    {
      "success": true,
      "generation_id": "550e8400-e29b-41d4-a716-446655440000",
      "message": "Content generation started. Results: https://junis.ai/content/550e8400...",
      "model": "stability-ai/sdxl"
    }
    ```
  </Tab>

  <Tab title="Wait Mode">
    **`prefer_wait=true`** - Wait for completion (polling)

    The tool polls every 10 seconds until completion, with a maximum timeout of 15 minutes. Useful for integrations that need immediate results.

    **Return Structure (on success):**

    ```json theme={null}
    {
      "success": true,
      "generation_id": "550e8400-e29b-41d4-a716-446655440000",
      "status": "completed",
      "output_url": "https://replicate.delivery/...",
      "storage_url": "https://objectstorage.kr-central-2.kakaocloud.com/...",
      "content_type": "image",
      "processing_time_ms": 12500,
      "model": "stability-ai/sdxl"
    }
    ```
  </Tab>
</Tabs>

### Popular Models

| Category  | Model                                 | Example Use               |
| --------- | ------------------------------------- | ------------------------- |
| **Image** | `stability-ai/sdxl`                   | High-quality images       |
| **Image** | `black-forest-labs/flux-schnell`      | Fast image generation     |
| **Video** | `stability-ai/stable-video-diffusion` | Short video clips         |
| **Audio** | `meta/musicgen`                       | Music generation          |
| **3D**    | `abiruyt/text-to-3d`                  | 3D model generation (GLB) |

### Credit Cost Lookup

Credit costs are determined by a priority-based lookup system:

1. **Exact Match**: `stability-ai/sdxl` → matches pattern `stability-ai/sdxl`
2. **Provider Wildcard**: `stability-ai/sdxl` → matches pattern `stability-ai/*`
3. **Global Wildcard**: Any model → matches pattern `*`
4. **Default**: If no pattern matches, defaults to 1 credit

<Note>
  Credit costs are managed by administrators in the System Admin panel (ReplicateModelCredit table).
</Note>

***

## Credit Costs

Content generation costs vary by type and complexity:

| Content Type     | Typical Cost      |
| ---------------- | ----------------- |
| Image (standard) | 0.01-0.05 credits |
| Image (high-res) | 0.05-0.15 credits |
| Video (short)    | 0.10-0.50 credits |
| Audio            | 0.05-0.20 credits |
| 3D Model         | 0.20-0.50 credits |

<Tip>
  Check your credit balance in the Subscription page before generating large amounts of content.
</Tip>

***

## Best Practices

<AccordionGroup>
  <Accordion title="Write clear prompts" icon="pencil">
    Be specific about what you want:

    * Include style, mood, and subject details
    * Specify dimensions or duration if needed
    * Mention any constraints or requirements
  </Accordion>

  <Accordion title="Start with test generations" icon="flask">
    Test with smaller/faster generations before creating final content:

    * Use lower resolution for image tests
    * Create shorter video clips first
    * Iterate on prompts before final generation
  </Accordion>

  <Accordion title="Monitor your usage" icon="chart-line">
    Keep track of content generation:

    * Check the Content page regularly
    * Review credit consumption
    * Clean up unused content
  </Accordion>
</AccordionGroup>

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Generation takes too long">
    **Possible causes:**

    * High system load
    * Complex content request
    * Large output size

    **Solution:**

    * Wait for processing to complete (timeout: 15 minutes)
    * Check content status in Team > Content
    * Retry if the request times out
  </Accordion>

  <Accordion title="Generation failed">
    **Possible causes:**

    * Invalid prompt
    * Model temporarily unavailable
    * Insufficient credits

    **Solution:**

    * Check error message in content details
    * Modify your prompt and retry
    * Verify credit balance
  </Accordion>

  <Accordion title="Content not appearing">
    **Possible causes:**

    * Still processing
    * Page needs refresh

    **Solution:**

    * Refresh the page
    * Check the processing status
    * Wait a few moments and check again
  </Accordion>
</AccordionGroup>

***

## Related Guides

<CardGroup cols={2}>
  <Card title="Credit System" icon="coins" href="/guides/billing/credits">
    Understand credit consumption
  </Card>

  <Card title="Agent System" icon="robot" href="/getting-started/agent-system">
    Learn about AI agents
  </Card>
</CardGroup>
