Nodes/MediaForge/⚙️ AI Config
ComfyUI Node

⚙️ AI Config

Swap Whisper and translate providers without touching a single AI node

By leon80148·Created 4 months ago·Updated 2 months ago· 0
⚙️ AI Config
    • ai_config
    provideropenai_compatible
    base_urlhttps://api.openai.com/v1
    api_key
    modelgpt-4o-mini
    deviceauto

    MF_AIConfig is the settings brain of MediaForge's AI side. The pack's transcription and translation nodes don't take an API key or a model name themselves - they read an AI_CONFIG dict off a wire, and this is the node that builds it. Wire one of these into MF_WhisperTranscribe and MF_TranslateSubtitle, and the whole chain follows whatever you set here. Change provider once, every consumer moves with it.

    The trick it pulls off is that MediaForge's AI is provider-agnostic. You're not locked into OpenAI. The same openai_compatible provider speaks to Groq's whisper-large-v3 (routinely 5–10× faster than OpenAI's whisper-1 for similar quality, free tier included), a local Ollama instance at http://localhost:11434/v1, or faster_whisper_local for a fully offline in-process backend. For transcribing a one-hour podcast in under a minute, Groq is the recipe you'll actually reach for.

    How it works

    The node is declarative - it does no I/O itself. It just emits a dict with provider, base_url, api_key, model, and device, and the consuming node picks a backend based on provider. openai_compatible means "POST JSON to any OpenAI-API-compatible endpoint" (/audio/transcriptions for Whisper, /chat/completions for translate). faster_whisper_local lazy-imports the faster-whisper package and runs CTranslate2 inference in-process - the one backend that actually touches your GPU, via the device field.

    The schema is marked experimental. Fine for your own workflows; the author has said the AI_CONFIG shape may shift while Whisper and Translate get validated across providers. Don't build a business on it yet.

    The inputs that matter

    • provider - openai_compatible or faster_whisper_local. This one decision selects the entire backend.
    • base_url - trailing slash stripped automatically. Groq: https://api.groq.com/openai/v1. Ollama: http://localhost:11434/v1. LM Studio: http://localhost:1234/v1.
    • api_key - and this is where people get burned. Set it to env:OPENAI_API_KEY, not a literal key. The env: prefix resolves the named environment variable at runtime, so the secret never lands in your workflow JSON. That matters more than it sounds: ComfyUI bakes the whole graph into exported files and shared PNGs, and a plaintext key rides along in all of them. The pack also only lets env:-resolved keys go to allowlisted hosts (OpenAI, Groq, localhost by default), so a malicious shared workflow can't point env:SOME_SECRET at an attacker's endpoint. A literal key in the widget skips those guards - and a missing env var raises a clear error, not a confusing 401.
    • model - free-form. gpt-4o-mini is the default; Whisper auto-substitutes a real STT id if the one here isn't one, which is how one config can feed both a transcribe and a translate node.
    • device - only used by faster_whisper_local. Set cuda if you have the VRAM; CPU works but is slow.

    Install

    It ships with the pack, so install MediaForge once and it's there:

    cd ComfyUI/custom_nodes
    git clone https://github.com/leon80148/comfyui_MediaForge.git
    

    Then restart ComfyUI - or use ComfyUI Manager and search "MediaForge". requests (needed for any hosted provider) is already in the pack's requirements.txt, so Manager installs it automatically. Only faster_whisper_local needs extra setup: pip install faster-whisper, and the model downloads to the HuggingFace cache on first run.

    Gotchas

    The env: key + HTTPS rule catches people: non-loopback hosts require HTTPS for env-resolved keys, so a private-LAN Ollama box needs a plaintext key (fine - that's a local secret) or an HTTPS tunnel. And remember Ollama/LM Studio only speak openai_compatible for translate - they have no Whisper endpoint, so pair a local LLM with faster_whisper_local for a fully offline pipeline. If you see an error mentioning a missing env var, you set a name that doesn't exist - check your ComfyUI launch environment, not the node.

    CategoryMediaForge/AI

    Inputs (5)

    NameTypeDefaultDescription
    providerCOMBOopenai_compatible2 options: openai_compatible, faster_whisper_local
    base_urlSTRINGhttps://api.openai.com/v1
    api_keySTRING
    modelSTRINGgpt-4o-mini
    deviceCOMBOauto3 options: cpu, cuda, auto

    Outputs (1)

    NameTypeDescription
    ai_configAI_CONFIG