tongflow-router-cometapi

August 20, 2026 · View on GitHub

Official TongFlow plugin for CometAPI — one API key in front of 500+ models (OpenAI, Anthropic, Google, xAI, DeepSeek, Qwen, ByteDance, Kling, Sora, Veo, Wan, MiniMax …) behind OpenAI-compatible routes.

Capabilities

Implements these ABI slots (runs locally as a Python process, no GPU). Every slot has a per-node model picker:

AreaSlotsDefault modelRoute
Textgen-text, split-text, combine-textgemini-3.5-flashPOST /v1/chat/completions
Visionimage-describe, image-gen-textgemini-3.5-flashchat, image_url data URI
Video / audio understandingvideo-describe, video-gen-text, audio-describegemini-3.5-flashGemini models: native POST /v1beta/models/{model}:generateContent (inline media); others: chat video_url / input_audio parts
Imageimage-gengpt-image-2POST /v1/images/generations
Imageimage-edit, image-fusiongpt-image-2POST /v1/images/edits (multipart)
Videotext-gen-video, image-gen-video, images-gen-videosora-2 / happyhorse-1.1POST /v1/videos → poll GET /v1/videos/{id}
Videovideo-editomni-fast-v2v (beta)POST /v1/videos (JSON, inline MP4)
Speechtext-gen-speech-preset, text-gen-speech-instructgpt-4o-mini-ttsPOST /v1/audio/speech
Transcriptiontranscribe, transcribe-timestampwhisper-1POST /v1/audio/transcriptions

Live model list

The dropdown shows a curated shortlist (TONGFLOW_SLOT_MODELS, first entry = default) plus whatever CometAPI's public catalog (GET https://api.cometapi.com/api/models, no auth) currently exposes for that slot. The canvas fetches the catalog in the browser and filters it per slot with the rules in TONGFLOW_MODEL_CATALOG (e.g. gen-text = features contains text-to-text and endpoints contains /v1/chat/completions; upcoming models are hidden). The plugin applies the same rules at run time, so any id you pick from the dropdown is accepted. TTS / ASR models are shortlist-only — the catalog does not tag those endpoints.

Video sizes and durations are passed through as size (WxH; default 1280x720, or 720x1280 when the first reference image is portrait) and seconds (rounded, default 4); each model accepts a different set (Sora: 4/8/12 s, Veo 3.1: 4/6/8 s, Wan 2.7: 2–15 s …) and CometAPI returns a clear 4xx for unsupported values. Reference images are scale-and-center-cropped to the requested size (Pillow) because Sora rejects mismatched frames. Image generation sends size only when the node sets width/height — minimum sizes differ per model (Seedream 5 needs ≥ 1920×1920). Gemini through the OpenAI-compatible chat route drops video_url parts on CometAPI, so video/audio understanding goes through the native Gemini route for gemini-* models.

All 19 slots were exercised against the live gateway (2026-08-19): text, vision, video/audio understanding, GPT Image 2 + Seedream generation, edit + fusion, Veo 3.1 / Sora 2 / HappyHorse / Omni video, TTS, Whisper.

Credentials

Add in TongFlow Settings (gear icon, top-right):

KeyRequiredNotes
COMETAPI_KEYCreate one in the CometAPI console.
COMETAPI_BASE_URLoptionalOverride the default https://api.cometapi.com/v1.
COMETAPI_POLL_TIMEOUT_SoptionalMax seconds to wait for an async video task (default 900).
COMETAPI_TTS_VOICEoptionalDefault TTS voice when the node sets no speaker (default alloy).

Values are stored locally and take effect without a restart. requirements.txt pulls in Pillow (reference-image fitting); TongFlow installs it into the plugin venv automatically.

Smoke test

cd plugins/tongflow-router-cometapi
echo '{"nodeSlot":"gen-text","model":"gemini-3.5-flash","prompt":{"text":"Say hi in five words."}}' \
  | COMETAPI_KEY=sk-... PYTHONPATH=../../sdk python entry.py

Plugin logs go to stderr; stdout is the single ABI JSON response.

Getting help with CometAPI

Questions about CometAPI itself — pricing, model coverage, quota — go to CometAPI, not this repo: emery@askcometapi.com. Mention you came from TongFlow and they can set you up with starter credits.

Bugs in this plugin (a slot failing, a wrong request shape) belong in issues.