Skip to content

eternalai-org/eternalai-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eternalai CLI

Rust CLI for EternalAI's AI platform. Chat with uncensored language models, generate images and videos from effects or custom prompts, and manage media — from a terminal or as a JSON API for scripts and agents.

Warning: This is early, experimental software. Use at your own risk. APIs, commands, and behavior may change without notice.

Install

Shell script

curl -sSL https://raw.githubusercontent.com/180945/uncencored-cli/main/install.sh | sh

Build from source

git clone https://github.com/180945/uncencored-cli.git
cd uncencored-cli
cargo install --path .

Quick Start

# No API key needed — browse effects immediately
eternalai effects list
eternalai effects list --type image
eternalai effects list --type video --page 2

# JSON output for scripts
eternalai -o json effects list

# Check API health
eternalai status

To generate content, set up your API key:

eternalai setup
# Or manually:
eternalai config set-key YOUR_API_KEY

Chat with AI or generate images/videos:

# Chat with uncensored AI
eternalai chat send "tell me anything"
eternalai chat interactive

# Generate an image using an image effect
eternalai generate effect IMG_EFFECT_ID --images "./photo.jpg"
eternalai generate poll REQUEST_ID --wait
eternalai media download RESULT_URL --output result.png

# Generate a video using a video effect (input is a photo, output is a video)
eternalai generate effect VID_EFFECT_ID --images "./photo.jpg"
eternalai generate poll REQUEST_ID --wait
eternalai media download RESULT_URL --output result.mp4

# Custom prompt — you choose image or video output
eternalai generate custom "a cyberpunk city at night" --type image
eternalai generate custom "a cat walking through a neon alley" --type video

Configuration

API Key Setup

The CLI needs an API key to authenticate generation requests. Three ways to provide it (checked in this order):

  1. CLI flag: --api-key YOUR_KEY
  2. Environment variable: ETERNAL_AI_API_KEY=YOUR_KEY
  3. Config file: ~/.config/eternalai/config.json
# Save your API key
eternalai config set-key YOUR_API_KEY

# Check current config
eternalai config show

# Reset config
eternalai config reset

The config file (~/.config/eternalai/config.json):

{
  "api_key": "your-api-key-here",
  "api_base": "https://open.eternalai.org"
}

What Needs an API Key

Most commands work without a key — browsing effects, checking status. You need a key for:

  • Chat (chat send, chat interactive)
  • Generating images/videos (generate effect, generate custom)
  • Polling results (generate poll)

Output Formats

Every command supports --output table (default) and --output json.

# Human-readable table (default)
eternalai effects list

# Machine-readable JSON
eternalai -o json effects list

Short form: -o json or -o table.

Errors follow the same pattern — table mode prints Error: ... to stderr, JSON mode prints {"error": "..."} to stdout.

Commands

Chat

Chat with EternalAI's uncensored language model. Supports single messages, streaming, and interactive multi-turn conversations.

Endpoint: POST /v1/chat/completions (OpenAI-compatible) Default model: uncensored-eternal-ai-1.0

# Send a single message
eternalai chat send "what is the meaning of life"

# Stream the response in real-time (token by token)
eternalai chat send "explain quantum physics" --stream

# Use a system prompt to set behavior
eternalai chat send "write a poem" --system "you are a pirate"

# Limit response length
eternalai chat send "tell me a story" --max-tokens 200

# JSON output for scripts/agents
eternalai -o json chat send "hello"

# Interactive multi-turn conversation (remembers context)
eternalai chat interactive
eternalai chat interactive --system "you are a helpful coding assistant"

Interactive mode keeps conversation history so the AI remembers what you said earlier. Responses stream in real-time. Type exit to quit.

Effects

An effect is a pre-built visual transformation template hosted on EternalAI. Each effect has a fixed output type — either image or video. When you generate using an effect, the output type is determined by the effect itself (you don't choose it).

Some effects require input images (e.g., "turn your photo into a cartoon"), while others generate from scratch (e.g., "create a random abstract pattern"). Check an effect's details with effects get to see what it expects.

# List all effects
eternalai effects list

# Filter by output type — see only effects that produce images or videos
eternalai effects list --type image
eternalai effects list --type video

# Paginate
eternalai effects list --page 2

# Get details of a specific effect (shows type, description, required inputs)
eternalai effects get EFFECT_ID

Generate

There are two generation modes:

  1. Effect-based (generate effect) — Use a pre-built effect. The effect determines the output type (image or video). You provide input images if the effect requires them.
  2. Custom prompt (generate custom) — Describe what you want in a text prompt. You choose the output type (--type image or --type video).

Both modes are async — you get a request_id back immediately, then poll for the result.

# --- Effect-based generation ---
# The effect decides whether the output is an image or video.
# Use "effects list --type image" or "--type video" to find effects by output type.

# Generate from an effect (no input images needed if the effect doesn't require them)
eternalai generate effect EFFECT_ID

# Provide input images for effects that transform your photos
# (e.g., style transfer, face swap, cartoonify)
eternalai generate effect EFFECT_ID --images "https://example.com/photo.jpg"
eternalai generate effect EFFECT_ID --images "./photo.jpg,./photo2.png"

# --- Custom prompt generation ---
# You choose the output type explicitly with --type.

eternalai generate custom "a cyberpunk cat riding a motorcycle" --type image
eternalai generate custom "sunset over neon city" --type video

# Custom with input images (e.g., "transform this photo into anime style")
eternalai generate custom "transform this into anime style" --type image --images "./photo.jpg"

# --- Polling for results ---
# Generation is async. Use the request_id from the generate response.

# Single check
eternalai generate poll REQUEST_ID

# Auto-wait: polls every 15s (up to 6 attempts after initial 30s wait) until complete
eternalai generate poll REQUEST_ID --wait

Image inputs: Supports both URLs (passed directly) and local file paths (auto-converted to base64 data URIs). Comma-separated for multiple images.

Key difference: generate effect — the effect controls the output type. generate custom — you control the output type with --type.

Media

# Download generated media
eternalai media download https://example.com/generated.mp4
eternalai media download https://example.com/image.png --output my-image.png

# Open in default application
eternalai media open https://example.com/generated.mp4

Configuration

eternalai config set-key YOUR_API_KEY   # Save API key
eternalai config show                    # Show current config
eternalai config reset                   # Reset to defaults

Other

eternalai status      # API health check
eternalai setup       # Guided first-time setup wizard
eternalai shell       # Interactive REPL
eternalai --version
eternalai --help

Interactive Shell

eternalai shell
# eternalai> effects list --type image
# eternalai> generate custom "cool art" --type image
# eternalai> exit

Supports command history. All commands work the same, just without the eternalai prefix.

Common Workflows

Chat with uncensored AI

# Quick question
eternalai chat send "how do black holes work"

# Interactive conversation
eternalai chat interactive --system "you are a senior rust developer"
# you> how do I handle errors in async code?
# ai> In Rust, the standard approach is...
# you> show me an example
# ai> Here's a concrete example using anyhow...
# you> exit

# Use in a script (JSON output)
ANSWER=$(eternalai -o json chat send "summarize this in one sentence: $TEXT" | jq -r '.content')

Browse effects and understand what they do

# See all image-producing effects
eternalai effects list --type image

# See all video-producing effects
eternalai effects list --type video

# Check what a specific effect does and whether it needs input images
eternalai effects get EFFECT_ID

# List effect IDs for scripting
eternalai -o json effects list | jq '.[].id'

Generate an image using an effect

# 1. Find an image effect (output type = image)
eternalai effects list --type image

# 2. Check if it needs input images
eternalai effects get EFFECT_ID

# 3. Generate (provide --images only if the effect requires input photos)
eternalai generate effect EFFECT_ID --images "./my-photo.jpg"

# 4. Poll until done
eternalai generate poll REQUEST_ID --wait

# 5. Download the generated image
eternalai media download RESULT_URL

Generate a video using an effect

# 1. Find a video effect (output type = video)
eternalai effects list --type video

# 2. Generate — the effect produces a video, not an image
eternalai generate effect EFFECT_ID --images "./my-photo.jpg"

# 3. Poll and download
eternalai generate poll REQUEST_ID --wait
eternalai media download RESULT_URL --output result.mp4

Custom AI generation (no preset effect)

# Generate a custom image
eternalai generate custom "a dragon breathing fire over Tokyo" --type image
eternalai generate poll REQUEST_ID --wait
eternalai media download RESULT_URL --output dragon.png

# Generate a custom video
eternalai generate custom "a cat walking through a neon alley" --type video
eternalai generate poll REQUEST_ID --wait
eternalai media download RESULT_URL --output cat-neon.mp4

Script with JSON output

# Pipe to jq
eternalai -o json effects list | jq '.[].name'

# Generate and extract request ID
REQUEST_ID=$(eternalai -o json generate custom "cool art" --type image | jq -r '.request_id')

# Poll programmatically
eternalai -o json generate poll "$REQUEST_ID" --wait | jq '.result'

Architecture

src/
  main.rs          -- CLI entry point, clap parsing, error handling
  auth.rs          -- API key resolution (flag > env > config)
  client.rs        -- HTTP client, API calls
  config.rs        -- Config file management
  shell.rs         -- Interactive REPL
  commands/        -- One module per command group
    effects.rs     -- effects list, effects get
    generate.rs    -- generate effect, generate custom, generate poll
    media.rs       -- media download, media open
    config_cmd.rs  -- config management
    setup.rs       -- guided setup wizard
    status.rs      -- health check
  output/          -- Table and JSON rendering
    effects.rs     -- effect output formatting
    generate.rs    -- generation result formatting
    media.rs       -- media info formatting
  utils/
    image.rs       -- local file → base64 data URI conversion
    polling.rs     -- async polling with retries

Platforms

Pre-built binaries are available for:

Platform Architecture
macOS arm64 (Apple Silicon), x86_64 (Intel)
Linux x86_64, aarch64
Windows x86_64

License

MIT

About

EternalAI CLI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors