Skip to main content

CLI for the Sun audio course generation API.

Project description

sun-cli

Command-line client for the Sun audio generation API. Generate audio from a prompt, poll for completion (or stream episodes as they finish), and download the manifest plus per-episode MP3 + image files — all from one binary.

Install

pip install sun-cli

Or with uv:

uv tool install sun-cli

Verify:

sun --help
sun --version    # prints "sun-cli <version>"

Python 3.10+ is required. macOS and Linux are first-class.

Quickstart

# 1. Log in (email + password).
sun login

# 2. Mint a personal API token — secret is printed once.
sun tokens create laptop

# 3. Generate audio and wait for it to finish.
sun audio create \
  --prompt "A 30-minute course on the French Revolution" \
  --duration-minutes 30 \
  --wait

# 4. Download the manifest + per-episode MP3 + image files.
sun audio get <JOB_ID> --out ./french-revolution
ls ./french-revolution
# overview.json
# cover.png
# episodes/001-causes.mp3
# episodes/001-causes.png
# episodes/002-...mp3
# ...

For streaming (download each episode the moment its audio is ready), pair --partial with a polling loop or register a webhook with --callback-url:

sun audio create --prompt "..." --callback-url https://your.handler/hook --json

# or, polling:
sun audio get <JOB> --partial --out ./out   # safe before SUCCESS; skips episodes still generating

Commands

sun --version
sun --help

sun login [--email EMAIL] [--password PASSWORD]
sun logout
sun whoami

sun tokens create NAME [--no-save]
sun tokens list [--json]
sun tokens revoke NAME|ID

sun audio create [--prompt TEXT] [--input PATH] [--duration-minutes N]
                 [--voice-id ID] [--callback-url URL] [--wait] [--json]
sun audio status JOB_ID [--json]
sun audio get    JOB_ID [--partial] [--json] [--out DIR]

sun courses ... still works as a hidden alias for backwards compatibility — it prints a one-line deprecation warning on stderr and runs the same command. Prefer sun audio in new scripts.

Authentication

The CLI uses two distinct auth modes:

  • Token management (sun tokens *) — uses the Supabase JWT persisted by sun login. A leaked API token cannot mint replacements.
  • Everything else (sun audio *, sun whoami) — uses a personal API token of the form sk_live_....

The Supabase URL and anon key are auto-discovered from the Sun API's public /v1/public/auth-config endpoint, so end users only need an email and password.

Credentials are stored at ~/.config/sun/credentials.json with mode 0600.

Configuration

Variable Purpose
SUN_API_BASE_URL Override the default API base URL (e.g. for staging or local dev).
SUN_TOKEN Use this API token instead of the credentials file. CI mode.
SUPABASE_URL, SUPABASE_ANON_KEY Optional override for sun login only. The CLI auto-discovers these otherwise.

Rate limits

Default: 3 successful-or-in-flight generations per rolling 24h per user (configurable per user). Failed generations don't count against the quota.

The server returns 429 with Retry-After and X-RateLimit-* headers when the limit is hit.

License

See LICENSE in the source repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sun_cli-0.2.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sun_cli-0.2.1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file sun_cli-0.2.1.tar.gz.

File metadata

  • Download URL: sun_cli-0.2.1.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for sun_cli-0.2.1.tar.gz
Algorithm Hash digest
SHA256 781b38aa2743cbaf854b2d7a2fe6a0fb66d30cdcee1447e5192bded7273f929b
MD5 2cfc24a10b87d8d8b46e9eaecc694864
BLAKE2b-256 8e723a52534d3ad2a3d699eb0a2dfb380a86fa878cb078b5683352edef3baa2c

See more details on using hashes here.

File details

Details for the file sun_cli-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: sun_cli-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for sun_cli-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 170e82e72e3cd8235166c5c40bde7d30c16dd8e84172152236d4861491885834
MD5 86e454660ff1ada2271ad04c4e14dab1
BLAKE2b-256 f768d922dfb83a5a80206c1e353915a8355d129638f65b57667bde3a23ac0001

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page