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

# nut resource

> Generate images, audio, and video with AI

# `nut resource`

Manage and generate resources (images, audio, video) using AI.

```bash theme={null}
nut resource [command]
```

**Aliases:** `resource`, `resources`

## Overview

The `nut resource` command enables you to manage and generate media assets. Upload files, manage metadata, and generate images, audio, and video using AI models directly from the command line.

***

## `nut resource list`

List all resources in your Coconut instance.

```bash theme={null}
nut resource list [options]
nut resource ls [options]
```

**Aliases:** `list`, `ls`

**Options:**

* `-s, --search <query>` - Filter resources by name, description, or tags
* `--type <type>` - Filter by media type prefix (e.g. image, audio, video)
* `--json` - Output as JSON
* `--api <url>` - API server URL (default: "[http://localhost](http://localhost)")

**Examples:**

```bash theme={null}
# List all resources
nut resource list

# Search for resources
nut resource ls --search "logo"

# Filter by type
nut resource list --type image --json
```

***

## `nut resource get`

Get details for a specific resource.

```bash theme={null}
nut resource get <id> [options]
nut resource show <id> [options]
```

**Aliases:** `get`, `show`

**Arguments:**

* `id` - Resource ID

**Options:**

* `--json` - Output as JSON
* `-o, --output <path>` - Download resource file to local path
* `--api <url>` - API server URL (default: "[http://localhost](http://localhost)")

**Examples:**

```bash theme={null}
# Get resource details
nut resource get res-1234567890-abc123def

# Get resource as JSON
nut resource show res-1234567890-abc123def --json

# Download resource file
nut resource get res-1234567890-abc123def -o ./downloaded-file.png
```

***

## `nut resource add`

Upload a file to resources.

```bash theme={null}
nut resource add <file...> [options]
nut resource upload <file...> [options]
```

**Aliases:** `add`, `upload`

**Arguments:**

* `file` - File path(s) to upload

**Options:**

* `-t, --tags <tags>` - Comma-separated tags
* `-d, --description <text>` - Description of the resource
* `--json` - Output as JSON
* `--api <url>` - API server URL (default: "[http://localhost](http://localhost)")

**Examples:**

```bash theme={null}
# Upload a single file
nut resource add ./screenshot.png

# Upload with tags and description
nut resource upload ./logo.svg -t "branding, logo" -d "Company logo"

# Upload multiple files
nut resource add ./image1.png ./image2.png -t "batch"

# Upload and output as JSON
nut resource add ./data.json --json
```

***

## `nut resource update`

Update resource metadata (tags, description).

```bash theme={null}
nut resource update <id> [options]
```

**Arguments:**

* `id` - Resource ID to update

**Options:**

* `-t, --tags <tags>` - Comma-separated tags (replaces existing)
* `-d, --description <text>` - Description (replaces existing)
* `--json` - Output as JSON
* `--api <url>` - API server URL (default: "[http://localhost](http://localhost)")

**Examples:**

```bash theme={null}
# Update tags
nut resource update res-123 -t "logo, branding"

# Update description
nut resource update res-123 -d "Updated description"

# Update both tags and description
nut resource update res-123 -t "new-tag" -d "New desc" --json
```

***

## `nut resource delete`

Delete a resource.

```bash theme={null}
nut resource delete <id> [options]
nut resource rm <id> [options]
```

**Aliases:** `delete`, `rm`

**Arguments:**

* `id` - Resource ID to delete

**Options:**

* `-f, --force` - Skip confirmation prompt
* `--json` - Output as JSON
* `--api <url>` - API server URL (default: "[http://localhost](http://localhost)")

**Examples:**

```bash theme={null}
# Delete a resource
nut resource delete res-1234567890-abc123def

# Delete without confirmation
nut resource rm res-1234567890-abc123def --force

# Delete and output as JSON
nut resource delete res-123 --json
```

<Note>
  Deleting a resource is permanent. Make sure you want to remove it before confirming.
</Note>

***

## `nut resource generate-image`

Generate an image using AI models via Replicate.

```bash theme={null}
nut resource generate-image <prompt> [options]
nut resource image <prompt> [options]
```

**Aliases:** `generate-image`, `image`

**Arguments:**

* `prompt` - Description of the image to generate

**Options:**

* `-m, --model <model>` - Model to use (default: `nano-banana-pro`)
* `--save` - Save generated image to resources (.nut/resources/)
* `-o, --output <path>` - Download image to local file path
* `--api <url>` - API server URL (default: "[http://localhost](http://localhost)")

**Models:**

| CLI flag          | Replicate model              | Notes                                                                                                                   |
| ----------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `nano-banana-pro` | google/nano-banana-pro       | Default. Supports resolution (1K/2K/4K), image input for style reference                                                |
| `flux-2-dev`      | black-forest-labs/flux-2-dev | Supports `--go-fast`, quality (60-100), image input                                                                     |
| `flux-2-pro`      | black-forest-labs/flux-2-pro | Supports resolution (0.5 MP–4 MP), `--safety` (1-6), image input                                                        |
| `gpt-image-1.5`   | openai/gpt-image-1.5         | Supports `--quality` (low/medium/high), `--background` (auto/transparent/opaque), limited aspect ratios (1:1, 3:2, 2:3) |

**Examples:**

```bash theme={null}
# Default model (nano-banana-pro)
nut resource image "A serene morning in Tokyo"

# Generate and save to resources
nut resource image "A serene morning in Tokyo" --save

# Use flux-2-pro and save to resources
nut resource image "A serene morning in Tokyo" -m flux-2-pro --save

# Use gpt-image-1.5 with high quality and save to file
nut resource image "Abstract art" -m gpt-image-1.5 --quality high -o ./art.png

# Generate and download to specific location
nut resource image "Product mockup for mobile app" --output ./assets/mockup.png
```

<Tip>
  Be specific in your prompts. Include details about style, composition, lighting, and mood for better results.
</Tip>

***

## `nut resource generate-audio`

Generate audio from text using AI text-to-speech.

```bash theme={null}
nut resource generate-audio <text> [options]
nut resource audio <text> [options]
```

**Aliases:** `generate-audio`, `audio`, `tts`

**Arguments:**

* `text` - Text to convert to speech

**Options:**

* `-v, --voice <id>` - Voice ID (default: "English\_Trustworth\_Man")
* `-s, --speed <number>` - Speech speed multiplier, 0.5-2.0 (default: "1")
* `-p, --pitch <number>` - Pitch adjustment, -12 to 12 (default: "0")
* `-e, --emotion <type>` - Emotion style (auto, happy, sad, angry, fearful, surprised, disgusted) (default: "auto")
* `-l, --language <lang>` - Language boost (default: "English")
* `-f, --format <format>` - Audio format (mp3, wav, ogg) (default: "mp3")
* `--save` - Save generated audio to resources (.nut/resources/)
* `-o, --output <path>` - Download audio to local file path
* `--api <url>` - API server URL (default: "[http://localhost](http://localhost)")

**Model:** Uses `minimax/speech-02-turbo` for high-quality text-to-speech generation.

**Examples:**

```bash theme={null}
# Generate audio narration
nut resource audio "Hello, welcome to Coconut!"

# Generate with specific voice and speed
nut resource tts "Welcome!" -v English_Calm_Woman -s 1.2

# Generate and save to resources
nut resource audio "This is a test" --save -f wav
```

<Note>
  Generated audio is suitable for narration, voiceovers, podcast intros, and other audio content needs.
</Note>

***

## `nut resource generate-video`

Generate a video using AI.

```bash theme={null}
nut resource generate-video <prompt> [options]
nut resource video <prompt> [options]
```

**Aliases:** `generate-video`, `video`, `vid`

**Arguments:**

* `prompt` - Description of the video to generate

**Options:**

* `-d, --duration <seconds>` - Video duration in seconds, 5-16 (default: "8")
* `-r, --resolution <res>` - Video resolution (480p, 720p, 1080p) (default: "720p")
* `-a, --aspect-ratio <ratio>` - Aspect ratio (16:9, 9:16, 1:1) (default: "16:9")
* `--start-frame <id>` - Resource ID of image to use as first frame
* `--end-frame <id>` - Resource ID of image to use as last frame
* `--no-audio` - Disable AI audio generation for the video
* `--save` - Save generated video to resources (.nut/resources/)
* `-o, --output <path>` - Download video to local file path
* `--api <url>` - API server URL (default: "[http://localhost](http://localhost)")

**Model:** Uses `google/veo-3.1-fast` for fast, high-quality video generation.

**Examples:**

```bash theme={null}
# Generate a short video
nut resource video "A rocket launching into space"

# Generate with specific parameters
nut resource video "Ocean waves" -d 12 -r 1080p --save

# Generate with start and end frames
nut resource vid "Scene transition" --start-frame res-abc --end-frame res-xyz

# Generate silent video and save locally
nut resource video "Silent timelapse" --no-audio -o ./timelapse.mp4
```

<Tip>
  Video generation takes longer than image or audio. Be patient and ensure you have a stable internet connection.
</Tip>

***

## Use Cases

### Documentation Assets

```bash theme={null}
# Create diagrams and illustrations
nut resource image "System architecture diagram showing microservices" --save

# Upload existing screenshots
nut resource add ./screenshot.png -t "docs, tutorial" -d "Dashboard screenshot"
```

### Marketing Materials

```bash theme={null}
# Social media content
nut resource image "Eye-catching banner for product launch" --save

# Video ads
nut resource video "Product showcase with dynamic camera movements" -d 15 --save
```

### Audio Content

```bash theme={null}
# Podcast intros
nut resource audio "Welcome to the Tech Talk podcast, where we discuss the latest innovations" --save

# Tutorial narration
nut resource audio "Step one: Open the application and navigate to settings" -v English_Calm_Woman -s 1.1
```

***

## Best Practices

<AccordionGroup>
  <Accordion title="Write detailed prompts">
    The quality of generated resources depends heavily on prompt clarity. Include specific details about what you want, including style, mood, colors, composition, and any key elements.
  </Accordion>

  <Accordion title="Iterate and refine">
    If the first result isn't perfect, refine your prompt and try again. Small changes in wording can produce significantly different results.
  </Accordion>

  <Accordion title="Organize outputs">
    Use the `--save` option to store resources in your Coconut instance, or `--output` to save files locally in organized directories.
  </Accordion>

  <Accordion title="Consider resource usage">
    AI resource generation can be computationally expensive. Be mindful of the number and complexity of assets you generate, especially videos.
  </Accordion>
</AccordionGroup>

***

## Model Information

* **Images:** Generated via Replicate's AI models
* **Audio:** Uses MiniMax speech-02-turbo for natural-sounding speech
* **Video:** Powered by Google's Veo 3.1 Fast model for efficient video generation

<Note>
  Resource generation requires the Coconut server to be running (`nut serve`) and a Replicate API token configured via `nut config set replicate <token>`.
</Note>
