@julien_c: Friday project: Readable rewrite of the hardware-detection module behind @midudev's canirun-ai. Same heuristics, shader…
Summary
A readable rewrite of the hardware-detection module behind canirun.ai, providing descriptive names, JSDoc, and cleaner code while preserving the original heuristics and spec tables.
View Cached Full Text
Cached at: 05/16/26, 07:16 AM
Friday project:
Readable rewrite of the hardware-detection module behind @midudev’s canirun-ai. Same heuristics, shaders & spec tables — just descriptive names + JSDoc.
https://t.co/A4Xjb6z7vv
julien-c/canirun.ai
Source: https://github.com/julien-c/canirun.ai
canirun-ai.js
A readable rewrite of the browser-side hardware-detection module used by canirun.ai — the site that tells you which local AI models your machine can run.
The original module ships minified as hardware-ui.<hash>.js. This is the same
code with descriptive names, sectioning, JSDoc, and named constants in place of
magic numbers. Behavior, thresholds, shaders, and spec tables are unchanged.
What it does
- Reads what the browser will disclose:
- WebGL
WEBGL_debug_renderer_info→ GPU vendor + renderer string - WebGPU
adapter.info→ device + architecture (when available) navigator.deviceMemory,navigator.hardwareConcurrency, User-Agent
- WebGL
- Benchmarks on-device:
- CPU: a ~30ms
sqrt + sin + cosloop - GPU compute (WebGPU): FMA loop → estimated GPU cores
- GPU memory bandwidth: WebGPU buffer copy, with WebGL texture-sampling fallback
- CPU: a ~30ms
- Falls back to spec-sheet lookup tables when APIs are blocked or vague (Apple GPUs report only “Apple GPU”; iOS hides everything; mobile vendors refuse to expose adapter info). Includes tables for desktop discrete GPUs, Apple Silicon, mobile SoC GPUs, and SBCs.
- Scores model fit: classifies a model as
can-run,can-run-slow,tight,cannot-run, orunknown, estimates tokens/sec, computes a 0–100 score and a letter grade S–F.
All detection runs locally in the browser — no network calls.
Usage
It’s an ES module:
import { detectHardware, scoreModel, describeDevice } from "./canirun-ai.js";
const hw = await detectHardware();
console.log(describeDevice(hw), hw);
// Score a 7B model that needs ~4.5 GB of memory
const result = scoreModel(4.5, hw, 4.5);
console.log(result); // { status, toksPerSec, memPct, score, grade }
Credits
Original by midudev. This repo is a code-clarity rewrite for educational purposes; the methodology, heuristics, and spec tables are his work.
Similar Articles
@julien_c: What hardware actually powers open-source AI? Not benchmarks. Not vendor marketing. Real-world community usage. We’re l…
Hugging Face launches a new Hardware resource to track real-world usage of GPUs, CPUs, VRAM, and inference hardware trends in the open-source AI community.
@julien_c: Today I'm launching a new project called SynthTraces It is a minimal codebase to generate synthetic coding agent sessio…
Julien Chaumond launches SynthTraces, a minimal codebase that generates synthetic coding agent session traces by having an open model (via HF Inference Providers) interact with a small local model (via llama.cpp) on real open-source codebases, producing over 2,000 Pi session traces for training and fine-tuning LLMs.
@tom_doerr: Decodes Claude Code architecture using source maps https://github.com/alejandrobalderas/claude-code-from-source…
A tweet announces a GitHub repository that decodes Claude Code's architecture using source maps, providing an educational 18-chapter book on the internals of Anthropic's AI coding agent.
I vibecoded something engineers are starring in github
The author announces iai-mcp, a local memory tool for Claude Code that retains context across sessions, and reflects on the positive community feedback and rapid iteration following its GitHub release.
@injaneity: i reverse engineered @OpenAI's Codex Computer Use and built pi-computer-use: a model agnostic computer use tool for my …
A developer reverse-engineered OpenAI's Codex Computer Use to build pi-computer-use, an open-source, model-agnostic macOS automation tool featuring ax-first navigation and vision fallback for supported models.