Skip to content
kochj23Public

About

Local AI media studio for macOS (Apple Silicon): images (A1111, ComfyUI, SwarmUI, MLX), AnimateDiff video, MLX TTS/voice cloning/STT/music, gallery, widgets, and a prompt-craft chat assistant on NovaAIKit (9 backends, Auto failover, offline built-in fallback, Keychain keys).

Topics

Resources

Security policy

Stars

6 stars

Watchers

1 watching

Forks

Repository files navigation

AI Studio

Build Platform License Version Apple Silicon AI

Local AI media studio for macOS on Apple Silicon. Generate images, video, speech, cloned voices and music on your own Mac, and refine prompts with an AI chat assistant that works with any local or cloud LLM, or with no AI at all.

  • Images: Automatic1111, ComfyUI (with ControlNet), SwarmUI and MLX native, with queue, prompt library and A/B comparison
  • Batch: prompt × seed × model grids, saved ComfyUI workflows as one-click presets, overnight queue
  • Inpaint / outpaint: paint a mask over any gallery image and regenerate just that region, or extend the canvas
  • Video: image-to-video with LTX-Video, AnimateDiff text-to-video, and narrated slideshows (prompt → script → images + voice + music → MP4)
  • Audio: 6 MLX TTS engines, voice cloning, speech-to-text, music generation
  • Chat: prompt-craft assistant on NovaAIKit (9 backends, Auto failover, built-in offline answers)
  • Gallery with find-similar-image search and seed/settings filters, WidgetKit widgets and a loopback status API

Written by Jordan Koch (@kochj23).


See it in action

A narrated tour of AI Studio (Nova's AI voice; all data on screen is synthetic sample data).

AI Studio 2.6: inpainting and image-to-video on your Mac

AI Studio 2.6: inpainting and image-to-video on your Mac

Architecture

graph TB
    subgraph App["AI Studio (SwiftUI, macOS 14+)"]
        Images[Images tab] & Videos[Videos tab] & Audio[Audio tab] & Chat[Chat tab] & Gallery[Gallery tab]
        Settings[Settings: Backends / AI / Chat / Output / Python / Defaults]
    end

    subgraph Media["Media generation"]
        BackendMgr[BackendManager<br/>health checks + selection]
        Queue[GenerationQueue<br/>FIFO, 500 items, persisted,<br/>scheduled start]
        Batch[BatchGrid + WorkflowPresetStore<br/>WorkflowSanitizer]
        Workflows[ComfyUI workflows<br/>LTXVideoWorkflow · InpaintWorkflow]
        Story[Story chain<br/>StoryScript · Narrator · SlideshowAssembler]
        Similar[ImageSimilarityIndex<br/>Vision feature prints]
        History[PromptHistory]
        A1111[Automatic1111]
        ComfyUI[ComfyUI<br/>REST + WebSocket]
        SwarmUI[SwarmUI]
        Daemon[Python daemon<br/>JSON lines over stdin/stdout]
    end

    subgraph AI["Chat AI (NovaAIKit 1.0)"]
        AppAI[AppAI.shared<br/>NovaAI]
        ChatAI[StudioChatAI<br/>requests, validation,<br/>built-in assistant]
        Kit[Auto failover · retries · timeouts<br/>Keychain keys · status]
    end

    Images --> BackendMgr --> A1111 & ComfyUI & SwarmUI & Daemon
    Images --> Batch --> Queue
    Queue --> BackendMgr
    Queue --> Workflows
    Images --> History
    Videos --> ComfyUI
    Videos --> Workflows --> ComfyUI
    Videos --> Story
    Story --> AppAI
    Story --> BackendMgr
    Story --> Daemon
    Gallery --> Workflows
    Gallery --> Similar
    Audio --> Daemon
    Chat --> ChatAI --> AppAI --> Kit
    Settings --> AppAI
    Daemon --> TTS[mlx_tts.py] & Clone[mlx_voice_clone.py] & STT[mlx_whisper_stt.py] & Music[mlx_music_gen.py] & Img[mlx_image_gen.py]
Loading

Chat request flow

sequenceDiagram
    participant U as User
    participant VM as ChatViewModel
    participant AI as AppAI (NovaAIKit)
    participant B as Backend (Auto order)
    U->>VM: Send (or a template)
    alt AI turned off
        VM-->>U: Built-in reply (templates still work)
    else AI on
        VM->>AI: stream(system + history + prompt)
        AI->>B: Ollama → MLX → TinyChat → TinyLLM → OpenWebUI → Nova Gateway → OpenRouter → OpenAI
        B-->>AI: streamed text (retry on 408/429/5xx, failover on refused/timeout)
        AI-->>VM: deltas
        VM->>VM: validate (strip think blocks, non-empty, cap 20k chars)
        alt valid
            VM-->>U: Reply labelled "AI · Ollama (qwen3:8b)"
        else every backend down / invalid reply
            VM-->>U: Built-in reply labelled "Built-in" + reason banner
        end
    end
Loading

Narrated slideshow flow

flowchart LR
    T[Topic] --> S{Use AI on?}
    S -- yes --> AI[AppAI writes the script<br/>narration | image prompt]
    S -- "no / AI down" --> Sen[Each sentence<br/>becomes a scene]
    AI --> E[Editable script]
    Sen --> E
    E --> Img[Active image backend<br/>one still per scene]
    E --> V{MLX voice?}
    V -- "yes (daemon up)" --> K[Kokoro TTS]
    V -- "no / daemon down" --> M[macOS voice]
    E -.optional.-> Mu[MusicGen bed]
    Img & K & M & Mu --> A[SlideshowAssembler<br/>AVFoundation]
    A --> MP4[MP4 in the videos folder]
Loading

Features

Image generation

Backend Protocol Highlights
Automatic1111 REST txt2img and img2img
ComfyUI REST + WebSocket Workflow-based, ControlNet
SwarmUI REST Session-based generation
MLX native Python daemon On-device via mflux / diffusionkit

Model picker with auto-detection per backend. SafeTensors-only enforcement (.ckpt, .bin, .pt blocked). Steps, CFG, sampler, dimensions, seed and batch size. Auto-save into date folders with metadata JSON.

Queue and prompt history: up to 500 queued generations (pause, resume, reorder, cancel). Pending work is saved to Application Support and restored paused after a relaunch, so nothing starts behind your back. A persistent prompt library with search, tags, favorites and de-duplication.

Batch (Images tab → Batch…):

  • Grids: one prompt per line × seeds (1, 2, 42, ranges like 100-103, or random 4) × any number of checkpoints. The whole grid is queued or nothing is; each image records its model in its metadata.
  • Workflow presets: import a ComfyUI workflow exported with Workflow → Export (API); it becomes a one-click preset. Put {{prompt}}, {{negative}} and {{seed}} where AIStudio should fill in values (a field that is exactly {{seed}} becomes a number).
  • Overnight: hold the queue and start it at a set time (01:00 by default). While it runs the Mac is kept from idle-sleeping.

Imported workflows are treated as untrusted. AIStudio refuses UI-format files, anything over 2 MB or 400 nodes, broken links, node types that run code or touch the network or arbitrary files (exec, eval, python, script, shell, command, http, url, download, text/file save and load nodes), and inputs that look like absolute, home-relative or .. paths. Before every run it checks that each node type exists on the server.

Inpaint / outpaint (Gallery → image → Inpaint / Outpaint…): paint over the area to change (brush, eraser, undo), and/or add up to 1024 px on any side, then describe what should appear. It runs on ComfyUI core nodes (LoadImageMask, ImagePadForOutpaint, MaskComposite, GrowMask, InpaintModelConditioning, ImageCompositeMasked): only the masked area and the new border change, and every other pixel is pasted back untouched. The result lands in the gallery, and you can keep editing it. Comparison: side-by-side with synchronized zoom, or a slider overlay.

Video

Three modes in the Videos tab:

  • Image → Video (LTX-Video): pick a start image and describe the motion. Runs Lightricks LTX-Video through ComfyUI's built-in LTXV nodes (LTXVImgToVideo, LTXVConditioning, LTXVScheduler, SamplerCustomAdvanced). It needs ltx-video-2b-v0.9.5.safetensors in ComfyUI/models/checkpoints and t5xxl_fp16.safetensors in models/text_encoders (or clip). AIStudio checks for both first and says exactly what's missing. Sizes are snapped to multiples of 32 and frame counts to 8·n + 1. Measured on an M-series Studio: 17 frames at 512×320, 12 steps, in 88 s, including loading the model from cold.
  • Text → Video (AnimateDiff): frame count, FPS and resolution.
  • Narrated Slideshow: a topic becomes a script, one scene per line narration | image prompt. The script is written by the AI backend (NovaAIKit), or, with AI off, each sentence becomes a scene. Edit the script, then Build: the active image backend draws each scene, MLX TTS (Kokoro) or the built-in macOS voice narrates it, an optional MusicGen bed plays underneath at low volume, and AVFoundation assembles the MP4. A 2-scene test video (5.3 s) took 39 s with ComfyUI SDXL and the macOS voice.

Frames are combined to MP4 with AVAssetWriter.

Audio suite

  • Text to speech: Kokoro (11 voices), Dia, Chatterbox, Spark, Breeze, OuteTTS via mlx-audio
  • Voice cloning: f5-tts-mlx with auto-transcription (mlx-whisper) and 24 kHz resampling
  • Speech to text: mlx-whisper, tiny to large-v3
  • Music: MusicGen via transformers

Chat assistant (AI)

A prompt-craft assistant with streaming replies, conversation history, a system prompt, temperature and max tokens, plus four one-click templates: Improve Prompt, Negative Prompt, Describe Image and Style Transfer. Every assistant reply shows where it came from ("AI · Ollama (qwen3:8b)" or "Built-in").

AI runs on NovaAIKit 1.0, the shared AI layer of all Jordan Koch Mac apps:

On/off "Use AI" in Settings > AI and in the Chat panel. Off = nothing is sent anywhere.
Backends Auto, Ollama, MLX (mlx_lm.server), TinyLLM, TinyChat, OpenWebUI, Nova Gateway / fleet, OpenRouter, OpenAI
Auto Tries backends in the order above and uses the first that answers; a backend that just failed is skipped for a minute
Models / URLs Model picker per backend (listed live from the server), every URL editable, Test Connection
Resilience Per-request timeouts, retries with backoff on 408/429/5xx, failover on refused connections/timeouts
Validation Replies are cleaned of <think> blocks, must be non-empty, capped at 20,000 characters
Fallback AI off or every backend down: the built-in assistant answers. Templates still produce a usable result (improved prompt with quality modifiers, a standard negative prompt, three style variants, a describe-image skeleton); free-form questions get a clear "AI unavailable" note.
Status NovaAIStatusIndicator in the Chat panel (green online, orange offline, grey off; click to re-check)
Keys Keychain only, service com.jkoch.aistudio.<backend>, account apiKey. Keys are sent only over https.

Removed in 2.5.0: AIStudio's own LLM manager, load balancer and model registry (NovaAIKit's Auto failover replaces them). The old "use all local models / all frontier models / route through Nova" pool toggles are gone; pick Auto or a specific backend instead. AIStudio never shipped Google/Azure/AWS/IBM backends.

Gallery, widgets, API

  • Gallery: browse, filter by type, search by prompt, sort by date, metadata panel, reveal in Finder, delete. Filters on the settings saved with each image: exact seed, model, sampler, size and minimum steps. Find Similar ranks the gallery by visual similarity to the selected image. It uses on-device image embeddings from Vision's feature print (VNGenerateImageFeaturePrintRequest), cached per file version in Application Support. These are not CLIP embeddings: CLIP would need a separate model download and a tokenizer, and only adds text-to-image search, which the prompt search already covers for generated images.
  • WidgetKit: small, medium and large widgets with image-backend and AI-backend status and recent generations
  • Local API: port 37425, loopback only: GET /api/status, GET /api/ping

Resilience

Media backends: retry with exponential backoff and jitter (httpBackend, pythonDaemon, healthCheck presets); the Python daemon restarts itself after a crash, up to 5 times. Chat: NovaAIKit's retry/failover (above).


Requirements

  • macOS 14 Sonoma or later, Apple Silicon
  • Optional: Automatic1111 / ComfyUI / SwarmUI for those image backends
  • Optional: a Python venv for the MLX features (below)
  • Optional: any chat backend (e.g. ollama serve with ollama pull qwen3:8b); without one, chat uses the built-in assistant

Installation

From DMG

  1. Open AIStudio-v2.5.0-build8.dmg.
  2. Drag AIStudio onto Applications.
  3. Launch it from Applications.

Local builds are ad hoc signed. If macOS says the developer cannot be verified: System Settings > Privacy & Security > Open Anyway, or xattr -dr com.apple.quarantine /Applications/AIStudio.app. Developer ID + notarized releases open with no prompt; see RELEASE.md.

First run

  1. Settings > AI: leave Auto, or pick a backend and model. Add an OpenRouter/OpenAI key there if you want cloud models (it shows as "stored", never as text).
  2. Settings > Backends: point the image backends at your servers.
  3. Settings > Python: path to the venv python3 for MLX features.

MLX native setup (optional)

python3 -m venv venv && source venv/bin/activate
pip install 'mlx-audio[kokoro]' f5-tts-mlx mlx-whisper numpy Pillow
brew install espeak-ng   # voice cloning phonemizer
pip install mflux        # MLX image generation

Building from source

Requires Xcode 16 or later. Swift Package dependency: NovaAIKit (https://github.com/kochj23/NovaAIKit.git, from 1.0.0), resolved automatically. The MLX features run through Python, so no Metal Toolchain is needed.

git clone git@github.com:kochj23/AIStudio.git
cd AIStudio
xcodebuild -project AIStudio.xcodeproj -scheme AIStudio -configuration Release -derivedDataPath ./dd build
open AIStudio.xcodeproj      # or build and run with Cmd+R

Release packaging (Developer ID, notarization, DMG): ./scripts/release.sh <version>, see RELEASE.md.


Security

  • Keys in the Keychain only (com.jkoch.aistudio.*), never in UserDefaults or logs; refused over plain http
  • SafeTensors only: pickle-based model files are blocked
  • Prompt injection prevention: prompts go to the Python side via temp files, not string literals
  • stdout isolation protects the daemon's JSON protocol
  • SecureLogger redacts API keys, tokens and PII
  • Path traversal prevention: ../, symlinks and a 4096-byte cap are checked
  • ComfyUI workflows are untrusted input: imported presets are validated (API format, size and node caps, no code-execution, network or file-access node types, no path-shaped inputs), then re-validated and checked against the server's node list before every run
  • Local state files (queue, presets, similarity cache) are written with 0600 permissions
  • No telemetry: the app talks only to the servers you configure

Testing

xcodebuild test -project AIStudio.xcodeproj -scheme AIStudio -destination 'platform=macOS'
cd AIStudio/Python && python -m pytest tests     # Python daemon tests
Swift suite Covers
AIKitAdoptionTests The chat AI contract, in 7 categories: security (Keychain service names, no key over http, keys never in settings, no legacy AI client left), performance (built-in reply speed, offline chat doesn't hang), retry (503 retried, refused connection bounded), unit (message building, clamping, validator, every built-in template, legacy import), integration (one-time settings migration, plaintext key to Keychain, Ollama streaming, Auto failover), functional (AI off, offline, empty reply, full send path), frame/UI state (status states, indicator colors, settings/indicator/message views lay out)
ComprehensiveTests Models, security, integration, functional and frame tests across the app
ModelTests Data models, enums, Codable, error types (incl. NovaAIKit backends and errors)
HighValueCoverageTests Generation queue, SafeTensors guard, prompt history filtering
SecurityUtilsTests, SecureLoggerTests Input validation, path traversal, redaction
FileOrganizerTests, ImageUtilsTests, RetryHandlerTests Output layout, image validation, backoff
ImageToVideoTests LTX-Video request snapping, workflow graph wiring, pre-flight messages, ComfyUI execution errors
BatchGridTests, WorkflowSanitizerTests, BatchQueueTests Grid expansion and seed parsing, workflow validation and placeholder filling, preset storage, queue persistence, scheduling
InpaintTests Mask rendering (orientation, eraser, coverage), view-to-image mapping, request limits, workflow graph, payload
StoryScriptTests, StoryChainAITests, SlideshowAssemblerTests Script parsing, AI / AI-off / AI-down scripting, macOS narration, MP4 assembly (duration, tracks, size)
GalleryFilterTests, ImageSimilarityTests Settings filters, nearest-neighbour ranking, feature-print cache, the gallery's similar mode
ComfyUIIntegrationTests Opt-in end-to-end runs against a real ComfyUI: inpaint, outpaint, LTX image-to-video, a workflow preset, and a narrated slideshow

Run the end-to-end tests against your own ComfyUI (they need the SDXL and LTX-Video models):

TEST_RUNNER_AISTUDIO_COMFY=1 xcodebuild test -project AIStudio.xcodeproj -scheme AIStudio \
  -destination 'platform=macOS' -only-testing:AIStudioTests/ComfyUIIntegrationTests

No test touches the real Keychain or a real AI server: NovaAIKit runs with in-memory keys/settings and a stub URLProtocol.


Version history

See CHANGELOG.md for details.

Version Highlights
2.6.0 LTX-Video image-to-video, batch grids, ComfyUI workflow presets, overnight queue, inpaint/outpaint canvas, narrated slideshows, find-similar and settings filters in the gallery
2.5.0 AI migrated to NovaAIKit 1.0.0: 9 backends, Auto failover, built-in offline assistant, Keychain-only keys, status indicator
2.4.0 Multi-model load balancing, OpenRouter frontier models (superseded by 2.5.0)
2.3.2 Prompt injection fix, SafeTensors enforcement
2.3.1 Daemon pipe buffering fix, voice cloning auto-transcription
2.3.0 Queue, prompt history, comparison, ControlNet, LLM streaming, retry/backoff
2.2.0 WidgetKit extension
2.1.0 LLM chat
2.0.0 Rewrite: audio, video, gallery, multi-backend
1.0.0 Initial release with Automatic1111

License

MIT License, see LICENSE. Copyright (c) 2026 Jordan Koch.

Disclaimer: This is a personal project created on my own time. It is not affiliated with, endorsed by, or representative of my employer.

About

Local AI media studio for macOS (Apple Silicon): images (A1111, ComfyUI, SwarmUI, MLX), AnimateDiff video, MLX TTS/voice cloning/STT/music, gallery, widgets, and a prompt-craft chat assistant on NovaAIKit (9 backends, Auto failover, offline built-in fallback, Keychain keys).

Topics

Resources

Security policy

Stars

6 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages