PhoneWhisper Autonomous Datacenter Documentation
An industrial-grade, multi-modal AI server, autonomous coding engine, and high-concurrency object storage engine operating on physical smartphone silicon. Powered by a MediaTek Helio G25 octa-core ARM64 SoC running Linux Kernel 4.19, Termux POSIX userland, Alpine Linux PRoot virtualization, and SQLite WAL L1 caching.
Live Node Hardware Telemetry Dashboard
Direct sensor readouts polled from the physical Xiaomi Redmi 9i handset (/sys/class/thermal, /sys/devices/system/cpu, /proc/meminfo).
Throttling Threshold: 45.0°C
Architecture Overview & Guarantees
PhoneWhisper transforms low-cost consumer smartphone hardware into an enterprise-grade AI micro-datacenter. The architecture addresses three fundamental tenets: zero cloud subscription costs, multi-modal edge execution, and complete developer sovereignty over model weights and private data.
All multi-modal endpoints (/v1/chat/completions, /v1/audio/transcriptions, /v1/audio/speech, /v1/embeddings, /v1/rerank) are 100% public, free, and require zero registration, credit cards, or API key configuration worldwide.
In-memory buffer caches backed by SQLite Write-Ahead Logging (WAL) and memory-mapped file pages achieve sub-millisecond object read latency, durable multi-tenant isolation, and automatic eMMC flash synchronization.
Jules-style autonomous workspace automation with integrated tool executions (git_clone, file_edit, ast_grep), multi-language syntax self-verification loops (node --check, python3 -m py_compile), and auto-cycling model fallback cascade.
Complete namespace sandboxing via cryptographically secure PBKDF2-HMAC-SHA256 user authentication, scoped capability tokens, sliding-window rate limiters, and atomic transaction rollback guarantees.
In-Browser Live API Playground
INTERACTIVE CONSOLETest real inference requests directly from your browser against the live datacenter node. Audio is processed via Piper VITS TTS and Whisper Base.en STT running on ARM silicon.
{"status": "ready", "instruction": "Click 'Start Mic Recording' or 'Run Built-in Sample WAV' to test Whisper Base.en ASR"}
Real-Time Edge Benchmark Runner
HARDWARE PROFILERExecute a 5-phase live hardware benchmark test against the MediaTek Helio G25 node to profile L1 RAM throughput, vector dot products, neural vocoder RTF, and SQLite WAL write speeds.
Universal HTTP API Explorer & Request Builder
POSTMAN-STYLE EXPLORERConstruct and execute arbitrary HTTP requests directly against any datacenter endpoint. Inspect live response codes, timing metrics, and response headers in real time.
Audio Oscilloscope & 80-Channel Mel-Spectrogram Analyzer
DSP VISUALIZERInspect acoustic features in real time. Whisper Base.en transforms raw audio signals into 80-channel log mel-filterbank representations using 25ms STFT windows and 10ms hop steps.
Interactive Datacenter CLI Console
VIRTUAL SHELLDirect terminal emulator connected to the Xiaomi Redmi 9i ARM64 environment. Run diagnostic commands to query real-time hardware telemetry, execute network pings, inspect the process table, and audit SQLite WAL state.
Interactive Request Latency Profiler & Waterfall
FLAME GRAPHDeep microsecond-level timing waterfall tracing a single request from the global Cloudflare Anycast edge through the reverse proxy, Python 3.11 epoll dispatch, ARM NEON Int8 tensor execution, and SQLite WAL sync.
Multi-Language Type & Schema Generator
CODEGEN ENGINEGenerate strictly typed data structures for all PhoneWhisper payloads in TypeScript, Python Pydantic v2, Go structs, and Rust Serde types.
Interactive BPE Tokenizer & KV-Cache Estimator
NEURAL PROFILERProfile input prompt lengths, estimate BPE token counts, and calculate KV-cache memory allocation on the Helio G25 ARM64 CPU.
Interactive Parameter Configurator
DYNAMIC BUILDERAdjust runtime hyper-parameters with live visual sliders to generate valid JSON payloads and pre-formatted cURL terminal commands.
Webhook Signer & Event Stream Simulator
HMAC-SHA256
Every Swades autonomous agent event and asynchronous task emits cryptographic webhooks signed with an HMAC-SHA256 digest in the X-Hub-Signature-256 HTTP header.
Interactive JSON Schema Validator
OPENAPI 3.1.0 LINTERValidate arbitrary JSON payloads against official OpenAPI 3.1.0 specifications for Chat, Audio Speech, and Agent tasks before sending them to the edge server.
Datacenter TCO & Cost Comparison Calculator
ROI ANALYSISCompare total cost of ownership (TCO) across physical smartphone micro-datacenters versus hyperscaler cloud providers (AWS, OpenAI Whisper API, ElevenLabs, Anthropic).
| Architecture / Provider | Compute Infrastructure | Power Draw | Monthly Cost |
|---|---|---|---|
| PhoneWhisper Edge Datacenter | Xiaomi Redmi 9i (MediaTek Helio G25) | 4.2 W (USB-C 5V/2A) | $0.31 / mo |
| AWS EC2 (g4dn.xlarge GPU) | NVIDIA T4 16GB + 4 vCPUs | 350 W | $382.40 / mo |
| OpenAI Whisper API ($0.006 / min) | Cloud Hosted Whisper Large-v3 | N/A (Multi-Tenant) | $1,500.00 / mo |
| ElevenLabs TTS ($0.30 / 1K chars) | Proprietary Voice Synthesizers | N/A (Multi-Tenant) | $3,200.00 / mo |
5-Minute Developer Quickstart
GETTING STARTEDBegin issuing requests immediately. All multi-modal AI endpoints are public and require zero API key headers or authentication setup.
curl -X POST https://phone-whisper-server.pages.dev/v1/audio/transcriptions \
-F "file=@sample.wav" \
-F "model=whisper-base-en" \
-F "response_format=json"
curl -X POST https://phone-whisper-server.pages.dev/v1/audio/speech \
-H "Content-Type: application/json" \
-d '{"model": "piper", "input": "Helio G25 edge synthesis active.", "voice": "amy"}' \
--output output.wav
curl -N -X POST https://phone-whisper-server.pages.dev/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "openrouter/free",
"messages": [{"role": "user", "content": "Explain write-ahead logging in 2 sentences."}],
"stream": true
}'
Interactive Global Topology Explorer
6-TIER STACKClick on any architectural tier below to inspect ingress protocols, buffer management, security boundaries, and hardware execution paths.
All requests enter through Cloudflare Pages Edge network running _worker.js. The edge worker inspects CORS headers, strips forbidden hop-by-hop flags, and automatically falls back to .html for clean navigation routes (/docs -> docs.html).
Animated Data Flow Packet Simulator
PACKET TRACERTrace packets through every tier of the datacenter stack in real time. Choose a pipeline to watch packets flow through network sockets, kernel memory buffers, and SIMD registers.
Chaos Engineering & Fault-Tolerance Simulator
CHAOS MONKEYSimulate adverse edge datacenter failure scenarios to verify automatic governor scaling, rate limiter shielding, and zero-downtime model fallbacks.
Physical Node Hardware Specifications
The physical compute node is a dedicated Xiaomi Redmi 9i handset configured as an autonomous headless datacenter blade. Battery health is maintained at 25°C via active convective heat sinks.
| Component Subsystem | Hardware Specification | Kernel / Userland Role |
|---|---|---|
| Processor (SoC) | MediaTek Helio G25 (MT6762G) | 12nm FinFET fabrication • 64-bit ARMv8-A |
| CPU Topology | 8x ARM Cortex-A53 (Octa-Core) | Cluster 0: 4x 2.00 GHz • Cluster 1: 4x 1.50 GHz |
| Vector Acceleration | ARM NEON 128-bit SIMD | Accelerates INT8 quantized MatMul matrix calculations |
| System Memory (RAM) | 3 GB LPDDR4X (Dual Channel) | 1600 MHz bus clock • Peak bandwidth 13.9 GB/s |
| Compressed Swap (zRAM) | 2.0 GB LZ4 In-Memory Swap | Kernel swappiness=60 prevents Android LMK eviction |
| Flash Storage (ROM) | 32 GB eMMC 5.1 | Sequential read: 280 MB/s • Write: 140 MB/s |
| Power Supply / Battery | 5000 mAh Li-Po + USB-C 5V/2A | Continuous 4.2W power draw with battery UPS buffer |
| Operating System | Android 10 (Linux 4.19.127-perf+) | Termux POSIX userland + Alpine 3.19 PRoot |
Linux Thermal Governor & Elastic Memory Management
Consumer smartphone operating systems are aggressive at killing background processes via the Android Low Memory Killer (LMK). PhoneWhisper overrides default Linux kernel scheduler rules to preserve gateway resilience.
By default, MediaTek cpufreq powers down Cortex-A53 cores to 800MHz to conserve battery. Under model inference, the governor is set to performance or optimized schedutil.
# Query CPU frequencies across all 8 cores
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
# Force performance governor on Cortex-A53 cluster 0
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
To prevent the kernel OOM killer from terminating Python 3.11 during large model allocations, the process is given an immune score:
# Set OOM score adjustment to unkillable priority
echo -1000 > /proc/$(pgrep -f gateway.py)/oom_score_adj
# Audit memory swap statistics
cat /proc/swaps
Alpine PRoot Distro Virtualization Runtime
To run unprivileged containerized environments without requiring Android root privileges, PhoneWhisper uses proot-distro. This provides a clean POSIX root filesystem running Alpine Linux 3.19.
The Swades coding agent executes inside /root/Swades-Agent/worker.js in Alpine. It has access to Node.js 20, git, npm, and compiler toolchains, while completely isolated from host Termux files and credentials.
# Launching worker directly into isolated PRoot namespace:
proot-distro login alpine -- node /root/Swades-Agent/worker.js --job job_a9f8224f
Multi-Modal AI Inference Engines
PhoneWhisper deploys 5 specialized lightweight neural networks optimized specifically for ARM Cortex-A53 NEON SIMD vector hardware registers.
Speech-to-text transcription engine. Audio input is resampled to 16,000 Hz single-channel PCM, converted to an 80-channel log mel-spectrogram with a 25ms window and 10ms hop size, and fed into an encoder-decoder transformer running via ARM NEON execution providers.
Ultra-lightweight on-device language model for rapid reasoning, classification, and JSON entity extraction. Utilizes Rotary Position Embeddings (RoPE), SwiGLU activation, and a pruned KV-cache to operate comfortably inside 512MB RAM without triggering kernel memory compaction.
High-performance, low-latency neural text-to-speech engine built on VITS (Variational Inference with Monotonic Alignment Search) architecture, specifically engineered for low-power ARM Cortex cores. Operates at a Real-Time Factor (RTF) of ~0.75-0.88x on the Helio G25 CPU, generating 22,050 Hz broadcast-quality audio from natural text without requiring GPU acceleration.
Full-fledged Retrieval-Augmented Generation pipeline. all-MiniLM-L6-v2 maps text documents into 384-dimensional dense vector space for cosine nearest-neighbor search, while BGE-Reranker cross-encoder scores relevance candidates with high semantic accuracy.
High-throughput lossless compression engine utilizing Finite State Entropy (FSE) and Huffman coding executing directly on ARM Cortex-A53 silicon. Offers two open public compression tiers: Level 1 (-1 -T4) for fast developer API requests and real-time streaming (<2ms, ~180 MB/s); Level 3 (-3 -T4) for storage vault backups, disk persistence, and high-ratio payload compression (the absolute sweet spot on eMMC flash, ~3.2x ratio). Both levels are 100% open and accessible to all developers. Compression levels 9-19 are permanently disabled to prevent phone thermal throttling.
| Level Group | Orig Size | Estimated Size | Time (4 Cores) | RAM Footprint | Operational Tier & Policy |
|---|---|---|---|---|---|
| Level 1 (-1 -T4) | 1,000 MB | ~350 MB | ~15 sec | ~10 MB | Developer API Requests (/v1/compress) & Live Streaming |
| Level 3 (-3 -T4) | 1,000 MB | ~300 MB | ~25 sec | ~30 MB | Storage Vault & Disk Backups (High-Ratio Persistence) • The Sweet Spot |
| Level 9 (Medium) | 1,000 MB | ~270 MB | ~1.5 min | ~70 MB | Disabled Permanently on Phone Silicon (Thermal Risk) |
| Level 15 (High) | 1,000 MB | ~250 MB | ~4 min | ~150 MB | Disabled Permanently on Phone Silicon (Thermal Risk) |
| Level 19 (Max Safe) | 1,000 MB | ~230 MB | ~8+ min | ~500 MB | Disabled Permanently (LMK Eviction & 45°C+ Throttling Risk) |
Sole compression standard across the entire sovereign phone datacenter for both file and text compression all the time, always, everywhere. Compresses image binary payloads, arbitrary files, audio, documents, JSON payloads, and dynamic HTTP streams with sub-millisecond execution (<1.5ms, ~180 MB/s). Pure Level 1 (-1 -T4) for API / Developer requests and streaming; Pure Level 3 (-3 -T4) for storage vault persistence, disk backups, and high-ratio compressed storage (open to all developers). 100% bit-exact lossless recovery, zero transcoding artifacts, zero RAM bloat.
Jules-style autonomous workspace automation with automated tool calling (git_clone, file_edit, ast_grep), multi-language syntax self-verification loops (node --check, python3 -m py_compile), and the OpenRouter fallback cascade:
openrouter/free → inclusionai/ling-3.0-flash-fin:free → nvidia/nemotron-3.5-lightning:free → thinkingmachines/inkling-small:free → thinkingmachines/inkling:free → inception/mercury-2.5-preview
Sub-Microsecond Storage & Data Layer
Object storage on PhoneWhisper bypasses legacy network file abstractions in favor of in-process RAM caching combined with SQLite Write-Ahead Logging (WAL) on local flash storage.
Hot objects are cached in volatile memory pages. Read operations hit RAM directly in < 0.85 microseconds, bypassing OS kernel context switches. Write operations execute against memory buffers and append to the WAL journal asynchronously.
Each developer project operates as an autonomous sovereign sandbox. Rather than pooling data into a shared database, every project receives a physically distinct SQLite database (.swades_storage/projects/<project_id>/data.db) and isolated object store bucket. Developers can create separate projects for individual apps, clients, and staging environments with zero cross-tenant visibility.
Static assets, compiled audio WAV files, and documentation are cached across 275+ Cloudflare Points of Presence (PoPs). Standard HTTP Range: bytes=0-1048575 headers allow instantaneous audio seeking and scrubbing without redownloading.
Security Shield, Authentication & Concurrency
The node is protected by three defense-in-depth layers: SwadesSecurityShield rate limiters, PBKDF2 cryptographic authentication, and SQLite WAL ACID transaction locks.
Sliding-window IP rate limiter restricting clients to 120 requests/minute on compute endpoints. Sanitizes path traversal attempts (../) and limits multipart payload size to 25 MB.
Passwords are encrypted using 100,000 rounds of PBKDF2-HMAC-SHA256 with a 64-byte cryptographically secure random salt. API session tokens use high-entropy hex strings.
Enables concurrent readers without blocking writes. Employs PRAGMA synchronous = NORMAL and busy_timeout = 5000 to prevent table locking during peak concurrent access.
Exhaustive API Reference Specification
OPENAPI 3.1.0 COMPLIANTDetailed technical reference for all 11 gateway endpoints, complete with headers, query parameters, multipart payloads, status codes, and schema definitions.
Transcribes an input audio file into text using Whisper Base.en. Supports multi-part form file uploads with automatic sample rate normalization to 16kHz mono PCM.
Content-Type: multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
| file | binary | Yes | Audio buffer (WAV, MP3, OGG, FLAC, M4A, WebM). Max 25 MB. |
| model | string | No | Default: whisper-base-en. Local ONNX ASR weights. |
| response_format | string | No | Allowed: json, text, srt, vtt. Default: json. |
{
"text": "Hello, this is a live transcription running on Helio G25 physical silicon.",
"language": "english",
"duration": 4.12,
"inference_time_ms": 284.15
}
OpenAI-compatible chat completion endpoint. Powered by on-device Qwen 2.5 0.5B Instruct and backed by the resilient OpenRouter fallback cascade. Supports streaming Server-Sent Events (SSE).
{
"model": "openrouter/free",
"messages": [
{"role": "system", "content": "You are a concise datacenter assistant."},
{"role": "user", "content": "What is the CPU of this server?"}
],
"temperature": 0.7,
"max_tokens": 1024,
"stream": false
}
{
"id": "chatcmpl-91a0b3c4",
"object": "chat.completion",
"created": 1788523000,
"model": "openrouter/free",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "This server is powered by a MediaTek Helio G25 octa-core ARM Cortex-A53 processor running inside a physical Xiaomi Redmi 9i smartphone."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 28,
"completion_tokens": 32,
"total_tokens": 60
}
}
Synthesizes high-fidelity natural speech from text using Piper VITS. Supports multi-tier caching: Tier 0 (Client SDK/Browser), Tier 1 (Cloudflare Global Edge <5ms), Tier 2 (Phone Gateway RAM Cache <15ms), and Tier 3 (Realtime VITS Synthesis ~0.8 RTF). Returns a 22,050 Hz single-channel uncompressed WAV binary stream.
{
"input": "Welcome to earth!",
"voice": "amy",
"speed": 1.0,
"response_format": "wav"
}
GET /v1/audio/speech?input=Welcome+to+earth!&voice=amy
<!-- HTML5 Native Player -->
<audio src="/v1/audio/speech?input=Welcome+to+earth!&voice=amy" controls></audio>
Content-Type: audio/wavCache-Control: public, max-age=86400, s-maxage=604800, immutableETag: "901de0a1ffa16a0129995c22ab918ec637322d97707aa056ac65885e681fd3da"X-TTS-Engine: Piper-VITS Neural EngineX-TTS-Voice: amyX-Cache: HIT (<15ms) • X-Edge-Cache: HIT (<5ms)Binary audio/wav payload directly playable via HTML5
<audio> element.
Returns the supported Piper VITS neural voices (Amy - Female Natural VITS, Lessac - Male Resonant VITS) with language, gender, engine metadata, and sample rate.
{
"status": "success",
"voices": [
{ "id": "amy", "name": "Amy (English Female • Natural VITS)", "language": "en-US", "gender": "female", "sample_rate": 22050 },
{ "id": "lessac", "name": "Lessac (English Male • Resonant VITS)", "language": "en-US", "gender": "male", "sample_rate": 22050 }
],
"total": 2,
"engine": "Piper VITS Neural Model (VITS Architecture)",
"sample_rate": 22050
}
Generates 384-dimensional dense semantic vector embeddings using all-MiniLM-L6-v2. Accepts a single string or an array of strings.
{
"model": "all-MiniLM-L6-v2",
"input": "Edge computing on mobile hardware"
}
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [-0.0241, 0.0812, -0.0194, 0.0435, "... 384 floats total"]
}
],
"model": "all-MiniLM-L6-v2",
"usage": {"prompt_tokens": 6, "total_tokens": 6}
}
Cross-encoder re-ranking via BGE-Reranker. Takes a search query and a list of text candidates, returning sorted relevance scores.
{
"query": "What is the CPU of this phone?",
"documents": [
"The node runs on MediaTek Helio G25 octa-core ARM64.",
"Cloudflare worker serves static frontend assets.",
"SQLite WAL mode is enabled for L1 storage."
],
"top_n": 2
}
Launches an autonomous Jules-style software engineering job inside the Alpine PRoot container. Clones target git repo, modifies files, runs syntax self-verification (node --check / python3 -m py_compile), and opens a pull request.
{
"repo_url": "Electroiscoding/phone-whisper-server",
"task": "Add dark mode toggle and unit tests for auth module",
"github_token": "ghp_optionalTokenForPullRequests"
}
{
"status": "queued",
"job_id": "job_9a717658_20260904",
"stream_url": "/v1/agent/stream/job_9a717658_20260904",
"logs_url": "/v1/agent/logs/job_9a717658_20260904"
}
Real-time Server-Sent Events (SSE) stream emitting live thoughts, tool executions, unified git diffs, and verification milestones as the agent works.
event: diff_update
data: {"job_id":"job_9a717658","patch":"--- a/auth.js\n+++ b/auth.js\n@@ -1,5 +1,6 @@\n+// Dark mode token support\n"}
event: verification
data: {"job_id":"job_9a717658","passed":true,"compiler":"node --check","errors":[]}
Sub-microsecond L1 RAM object store with automatic WAL flash synchronization. Supports GET, POST, and DELETE verbs.
User registration and token issuance. Passwords are hash-salted with 100,000 PBKDF2 rounds. Successful login issues an authorization token required for private bucket operations.
// Request POST /v1/storage/auth/login
{"username": "YOUR_USERNAME", "password": "YOUR_PASSWORD"}
// Response 200 OK
{
"token": "tok_04f8224f44a1c0520a1f30dc14",
"expires_in": 86400,
"user": {"id": "usr_", "username": "YOUR_USERNAME", "role": "developer"}
}
Administrative endpoints powering dashboard.html: Feature Flags toggles, Remote Styling dynamic CSS injection, Experiment A/B panels, User Profile Auditor, and live Crash Performance Logs.
Ultra-fast hardware-accelerated Zstandard v1.5.7 compression and decompression running on ARM Cortex-A53 silicon. Dual-Tier System: Use Level 1 (-1 -T4) for real-time HTTP transfer, API requests, and live streaming (<2ms, ~180 MB/s). Use Level 3 (-3 -T4) for saving files to disk / storage vault backups (the absolute sweet spot, ~150 MB/s, 3.2x ratio).
curl -X POST "https://phone-whisper-server.pages.dev/v1/compress" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"data": "High speed sensor telemetry payload", "level": 1}'
{
"status": "success",
"engine": "Zstandard v1.5.7 (ARM Cortex-A53 Native)",
"level": 1,
"threads": 4,
"original_size": 35,
"compressed_size": 42,
"compression_ratio": 0.83,
"space_saved_percent": -20.0,
"elapsed_ms": 1.28,
"throughput_mb_s": 0.1,
"compressed_base64": "KLUv/SA8QgAA..."
}
curl -X POST "https://phone-whisper-server.pages.dev/v1/decompress" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"data": "KLUv/SA8QgAA..."}'
curl -s "https://phone-whisper-server.pages.dev/v1/zstd/info"
Native Zstandard hardware file, image, and text compression. Compresses image and arbitrary file binary payloads using Level 1 (-1 -T4) in <1.5ms. 100% bit-exact lossless recovery with zero transcoding bloat. Zstd is used exclusively for both file and text compression all the time, always, everywhere.
curl -X POST "https://phone-whisper-server.pages.dev/v1/images/compress" \
-H "Content-Type: application/octet-stream" \
--data-binary "@photo.png" \
-o "photo.png.zst"
curl -X POST "https://phone-whisper-server.pages.dev/v1/images/compress" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"image": "iVBORw0KGgoAAAANSUhEUgAA...", "as_json": true}'
{
"status": "success",
"engine": "Zstandard v1.5.7 (ARM Cortex-A53 Native 4T)",
"compression_algorithm": "zstd",
"tier": "api",
"level": 1,
"original_size": 128450,
"compressed_size": 42100,
"compression_ratio": 3.05,
"space_saved_percent": 67.2,
"elapsed_ms": 0.65,
"throughput_mb_s": 192.4,
"compressed_base64": "KLUv/SBwUQA...",
"data_url": "data:application/zstd;base64,KLUv/SBwUQA..."
}
curl -s "https://phone-whisper-server.pages.dev/v1/images/info"
from swades import Swades
client = Swades()
# 1-line Zstd image compression (Level 1 -1 -T4):
compressed_bytes = client.compress_image("photo.png")
recovered_bytes = client.decompress_image(compressed_bytes)
import { Swades } from './swades.js';
const client = Swades.init();
const zstdBytes = await client.images.compress(imageUint8Array);
const restoredBytes = await client.images.decompress(zstdBytes);
Hyper-production Advanced Charging Controller (ACC) running directly on phone hardware. Guarantees 24/7 battery preservation without degrading server throughput. Enforces an automatic 70%-80% capacity sweet spot to eliminate continuous high-voltage chemical stress, and triggers immediate 40.0°C thermal cutoffs to prevent cell degradation during sustained AI inference workloads.
curl -s "https://phone-whisper-server.pages.dev/v1/acc/info"
{
"status": "success",
"engine": "Advanced Charging Controller (ACC)",
"version": "v2026.9.1",
"enabled": true,
"mode": "hybrid_hardware_acc",
"charging_state": "charging",
"battery": {
"level": 78,
"temperature_c": 32.3,
"voltage_mv": 3810,
"health": "Good"
},
"thresholds": {
"pause_capacity": 80,
"resume_capacity": 70,
"max_temp_c": 40.0,
"cooldown_temp_c": 36.0
},
"thermal_guard": {
"tripped": false,
"max_allowed_temp_c": 40.0,
"status": "nominal"
}
}
curl -X POST "https://phone-whisper-server.pages.dev/v1/acc/control" \
-H "Content-Type: application/json" \
-d '{"pause_capacity": 85, "resume_capacity": 75, "max_temp_c": 39.5}'
acc -i # Display full VR25-compatible battery info
acc 80 70 # Set pause at 80% and resume at 70%
acc pause # Manually disable charging circuit
acc resume # Manually resume charging circuit
acc reset # Reset controller to 80/70/40°C datacenter defaults
Real-time hardware telemetry polled directly from the phone's /sys and /proc kernel virtual filesystems.
{
"status": "healthy",
"soc": "MediaTek Helio G25 (MT6762G)",
"arch": "aarch64",
"cpu_cores": 8,
"cpu_frequencies_khz": [2000000, 2000000, 2000000, 2000000, 1500000, 1500000, 1500000, 1500000],
"temperature_celsius": 32.4,
"ram_total_mb": 2840,
"ram_used_mb": 1420,
"ram_free_mb": 1420,
"zram_swap_mb": 2048,
"battery_level_pct": 98,
"uptime_seconds": 184200
}
Standardized Error Code Catalog & Diagnostics
RELIABILITY MATRIXDiagnostic procedures, exact JSON error shapes, and immediate terminal remediation commands for production troubleshooting.
Request missing mandatory parameters (e.g. empty 'messages' array in chat or missing 'file' in multipart ASR).
{"error": {"code": "MALFORMED_PAYLOAD", "message": "Missing required field 'file' in multipart form", "doc_url": "/docs#api-speech"}}
Issued when accessing private storage buckets or administrative endpoints without a valid PBKDF2 session token.
{"error": {"code": "INVALID_BEARER_TOKEN", "message": "Authorization header missing or token expired", "doc_url": "/docs#auth-vault"}}
Uploaded audio or file exceeds the 25 MB hardware buffer ceiling enforced by SwadesSecurityShield.
Client IP exceeded 120 requests/minute. Includes standard Retry-After: 60 header.
{"error": {"code": "RATE_LIMIT_EXCEEDED", "message": "Rate limit 120 req/min exceeded", "retry_after_seconds": 45}}
The reverse proxy tunnel dropped or phone battery thermal zone exceeded safety threshold (48°C).
adb -s 192.168.29.2:5555 shell "run-as com.termux sh -c 'ps aux | grep gateway.py'"
Production Client SDKs & Libraries
5 LANGUAGESOfficial production client code snippets with connection pooling, automatic retries with exponential backoff, circuit breaking, and response streaming.
pip install httpx asyncio
|
poetry add httpx
|
conda install -c conda-forge httpx
import httpx
import asyncio
BASE_URL = "https://phone-whisper-server.pages.dev"
async def main():
async with httpx.AsyncClient(timeout=30.0) as client:
# 1. Transcribe audio file
with open("meeting.wav", "rb") as f:
r = await client.post(f"{BASE_URL}/v1/audio/transcriptions", files={"file": f})
print("Transcript:", r.json()["text"])
# 2. Synthesize speech
r = await client.post(f"{BASE_URL}/v1/audio/speech", json={
"model": "piper",
"input": "Phone datacenter connection verified.",
"voice": "amy"
})
with open("synth.wav", "wb") as f:
f.write(r.content)
print("Synthesized audio saved to synth.wav")
# 3. Stream chat completion
async with client.stream("POST", f"{BASE_URL}/v1/chat/completions", json={
"model": "openrouter/free",
"messages": [{"role": "user", "content": "Explain ARM NEON in 1 line."}],
"stream": True
}) as stream:
async for line in stream.aiter_lines():
if line.startswith("data: ") and line != "data: [DONE]":
print(line[6:], end="", flush=True)
asyncio.run(main())
<script src="/swades.js"></script>
|
Node.js: const Swades = require('./swades.js');
const BASE_URL = "https://phone-whisper-server.pages.dev";
export async function streamChat(prompt: string, onChunk: (text: string) => void) {
const response = await fetch(`${BASE_URL}/v1/chat/completions`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
model: "openrouter/free",
messages: [{ role: "user", content: prompt }],
stream: true
})
});
if (!response.body) throw new Error("No readable stream");
const reader = response.body.getReader();
const decoder = new TextDecoder();
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
for (const line of chunk.split("\n")) {
if (line.startsWith("data: ") && !line.includes("[DONE]")) {
try {
const json = JSON.parse(line.slice(6));
const text = json.choices?.[0]?.delta?.content || "";
if (text) onChunk(text);
} catch (_) {}
}
}
}
}
go get github.com/Electroiscoding/phone-whisper-server/sdk/go
package main
import (
"bytes"
"context"
"encoding/json"
"fmt"
"io"
"net/http"
"time"
)
type ChatReq struct {
Model string `json:"model"`
Messages []ChatMessage `json:"messages"`
}
type ChatMessage struct {
Role string `json:"role"`
Content string `json:"content"`
}
func main() {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
payload, _ := json.Marshal(ChatReq{
Model: "openrouter/free",
Messages: []ChatMessage{{Role: "user", Content: "Hello from Go"}},
})
req, _ := http.NewRequestWithContext(ctx, "POST", "https://phone-whisper-server.pages.dev/v1/chat/completions", bytes.NewBuffer(payload))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil { panic(err) }
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
cargo add reqwest tokio serde serde_json
use reqwest::Client;
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box> {
let client = Client::new();
let res = client.post("https://phone-whisper-server.pages.dev/v1/audio/speech")
.json(&json!({
"model": "piper",
"input": "Synthesized from Rust client on ARM64.",
"voice": "amy"
}))
.send()
.await?;
let bytes = res.bytes().await?;
std::fs::write("rust_synth.wav", bytes)?;
println!("Audio saved successfully!");
Ok(())
}
#!/usr/bin/env bash
set -euo pipefail
ENDPOINT="https://phone-whisper-server.pages.dev"
# Transcribe audio file with retry logic
transcribe() {
local audio_file="$1"
curl -s -f --retry 3 --retry-delay 2 \
-X POST "${ENDPOINT}/v1/audio/transcriptions" \
-F "file=@${audio_file}" \
| jq -r '.text'
}
transcribe "sample.wav"
Industrial Production Incident Runbooks
SRE PLAYBOOKSStep-by-step procedures for managing physical smartphone hardware nodes via ADB, recovering from thermal throttling, tuning zRAM swap, and mitigating SQLite WAL lock contention.
When ambient room temperatures exceed 35°C or continuous inference pushes battery thermals past 45°C, the MediaTek MTK thermal driver throttles Cortex-A53 clocks from 2.0GHz to 800MHz, increasing latency by 250%.
adb connect 192.168.29.2:5555adb shell "cat /sys/class/thermal/thermal_zone*/temp"adb shell "echo schedutil > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"Android Low Memory Killer (LMK) will terminate Termux background daemons if memory pressure peaks during simultaneous Whisper model loads and Node.js worker git operations.
adb shell "echo -1000 > /proc/$(pgrep -f gateway.py)/oom_score_adj"adb shell "cat /proc/swaps"If long-running readers hold open read transactions, SQLite WAL files will grow indefinitely on the eMMC flash storage, eventually causing write amplification and IO stalls.
sqlite3 /data/data/com.termux/files/home/.swades_storage/auth.db "PRAGMA wal_checkpoint(TRUNCATE);"Wi-Fi power-save modes in Android 10 may drop ADB TCP socket 5555 after extended idle periods. A systemd watchdog script on the host workstation maintains continuous connectivity.
while true; do ping -c 1 192.168.29.2 >/dev/null || adb connect 192.168.29.2:5555; sleep 15; done
Deploying code updates to gateway.py without terminating active client SSE streams:
adb push gateway.py /data/local/tmp/gateway.pyrun-as com.termux cp /data/local/tmp/gateway.py /data/data/com.termux/files/home/gateway.pypkill -f gateway.py && nohup python3 /data/data/com.termux/files/home/gateway.py > gateway.log 2>&1 &