SuperAPIAI Directory

cheap-im

github.com · AI agents

CPU-oriented realtime voice-agent harness that recreates multimodal interaction patterns like translation, interruption, and background tasks with mostly off-the-shelf components.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS · Linux

About this tool

cheap-im is a voice agent project that runs entirely on CPU, with the goal of reproducing on an ordinary laptop the surface behavior of the Thinking Machines interaction model demo (May 2026), including real-time voice, visually triggered proactive responses, real-time translation, and background tasks during conversation. The project does not attempt to match Thinking Machines' architecture—they trained a 276B MoE model from scratch, running on continuous audio and video in 200ms micro-turns—but instead glues commodity models together with a Python event loop to show how closely a carefully designed harness can approach those four behaviors.

Purpose and Positioning The project is mainly used for experimenting with and demonstrating real-time multimodal interaction patterns, and is suitable as a reference for developers studying voice interruption, visual triggering, real-time translation, and background task orchestration. It emphasizes running on a single CPU laptop, in a single process, in a single asyncio loop, with voice and vision both processed locally, while LLM calls are sent to DeepInfra.

Main Capabilities The project implements four demo behaviors, all of which can run end-to-end on a laptop with a real camera and microphone:

  1. Friend detection: YOLO11-pose on the camera emits a person_count_changed event, and a registered watcher triggers when a non-primary person appears.
  2. Real-time translation: Silero VAD segments phrase-level chunks, Whisper-large-v3-turbo on DeepInfra translates them into English, and Piper reads them aloud segment by segment in an interpreting style while the user continues speaking. When the user pauses at the end of a turn and speaks English, translation mode automatically exits.
  3. Slouching detection: determined by the angle between the shoulder-to-ear vector and the vertical direction, debounced over three frames (1.5 seconds) to avoid false triggers from momentary tilting.
  4. Search plus chart and continue the conversation: the foreground says "let me help you look", and a background worker calls Serper, then uses DeepSeek-V3.2 to generate a Chart.js specification. The user can interrupt and ask follow-up questions while the chart renders in the browser.

Usage The project requires Python 3.11 and is built and tested on Linux. The dependencies are cross-platform, but macOS and Windows have not yet been actually verified. During installation, pyproject.toml pins torch and torchvision to PyTorch's CPU-only wheel index, making the installation size about 250 MB instead of about 3 GB. Before running, you need to prepare:

  • Kroko model weights: download the Banafo Kroko ASR English (and other required languages) weights from the HuggingFace mirror, place the four files in the same folder, and set CHEAPIM_KROKO_MODEL_DIR in .env.
  • YOLO weights: ultralytics automatically downloads yolo11n-pose.pt (about 6 MB) on first use; other sizes can be specified via CHEAPIM_YOLO_MODEL.
  • Piper voice: use the Piper downloader to select a voice, generate .onnx and .onnx.json files and place them in models/piper/, and point the environment variable to the .onnx file.
  • Chart page: before starting the demo, open it with a normal browser at http://127.0.0.1:8765/,编排器不管理浏览器生命周期。 Command-line options:
  • --no-cam: Skip camera and YOLO loading; visual triggers remain in the table but are not automatically triggered.
  • --no-audio: Run from stdin without touching the microphone or TTS.
  • --no-audio --no-cam: Headless plain-text session; integration tests use this configuration.
  • --cam-debug: Open an OpenCV window showing the bounding boxes, keypoints, main person, real-time hunchback angle, and debounce count seen by YOLO; press q to close the window, and the orchestrator continues running headless.

Technical components Local components: Silero VAD (endpoint detection and interruption gating), Kroko ASR via sherpa-onnx (streaming speech-to-text), YOLO11-pose via ultralytics (person and pose detection at 4 fps), Piper (VITS TTS based on onnxruntime), WebRTC AEC3 via livekit Python bindings (acoustic echo cancellation on the microphone path), sounddevice and soundfile (microphone/speaker I/O and FLAC encoding for audio upload in translation mode), opencv-python (camera capture). Network APIs: DeepInfra provides meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo by default (foreground interaction model), deepseek-ai/DeepSeek-V3.2 (background reasoning/structured output model), openai/whisper-large-v3-turbo (called only in translation mode), and Serper (web search). Model calls go through DeepInfra's OpenAI-compatible endpoint; the base URL can be pointed to any OpenAI-format provider with a matching model name configured. Orchestrator core: httpx for streaming SSE, partial-json-parser for incrementally extracting the say field, python-dotenv for loading .env, fastapi + uvicorn + websockets to serve static HTML pages and render charts with Chart.js v4 (only for behavior 4).

Applicable scenarios and limitations Applicable scenarios: on a CPU laptop, demonstrate and experiment with real-time voice interaction, visual triggers, real-time translation, and background task orchestration; headless plain-text mode can be used to test the chart pipeline; --no-cam is suitable for environments without a camera or for CI. Limitations: The project explicitly does not match Thinking Machines' architecture and only reproduces surface behavior. It is built and tested only on Linux; macOS and Windows are unverified. Python 3.11 is required. When using speakers, it relies on WebRTC AEC3 to suppress self-interruption; if livekit is not installed, AEC degrades to a no-op. The default YOLO nano model runs at 4 fps on CPU, with end-to-end latency of about 150–300 ms, varying with hardware. Translation mode audio is billed per second and is included in cost estimates. Cost figures are based on DeepInfra pricing.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools