← 开源
Python
增长势头
+024 小时新增 Star0.0%
951
Star
1
Fork
+0
本周
1
贡献者
创建于 2017-12-12 · 更新于 2026-10-26 · 今日第 15605 名
主要开发者
README

SUSI Brain

SUSI Brain is the self-hosted compute backend for SUSI Builder. Run Brain on a workstation or server, connect your inference services, and give Builder a single host. Clients choose small or smart for chat, transcription and speech. The two aliases select different chat groups. For managed transcription and synthesis, either alias uses all models enabled for that service.

Run on your machine

Use Python 3.12 and install FFmpeg if you want to transcribe locally. From this checkout run

python3.12 -m venv .venv
. .venv/bin/activate
python -m pip install -e .
./run.sh

Open SUSI Brain. The default listener is loopback on port 8042. The installed commands susi-compute and python -m susi_brain compute accept the same arguments as ./run.sh.

The service packages are chat, speech to text, and text to speech. They share routing and configuration in src. The web interface lives in docs.

Configure a route

  1. Open Configuration → Chat Configuration to see models from the default local Ollama server at http://localhost:11434. To add another server, enter its address and optional provider key. Other providers use their OpenAI-compatible API base, including any prefix.
  2. Choose Add endpoint to discover its models. The table also checks for new models every 15 seconds while the page is visible. Select small, smart or Not used for each model. Assignments and optional Ranking values save automatically to the project-root config.json and apply to new requests. A model can belong to one group across endpoints and shares its ranking wherever it appears. Choose Add model route in the table to enter a provider model ID manually. Use Edit route beside a configured model to rename or remove the route, change its group, or choose its eligible endpoints. All matching endpoints includes future endpoints that offer the model. Choosing individual endpoints and clearing every selection keeps the route disabled and editable in the table. Click a saved address to edit it or its trash icon to remove it.
  3. Open Speech-to-text Configuration or Text-to-speech Configuration and add an endpoint. Switch a model On at each endpoint that should serve requests. Switch it Off to stop new assignments there. Edits save automatically. Edit route also lets you set eligible endpoints, ranking, and the default synthesis voice.

Open Monitor → Model Overview to watch chat, transcription and synthesis traffic. Each row identifies a model on one endpoint. In use now shows current work, and Calls routed, Traffic share and Last called show where traffic went, including calls that finished between updates. Choose Activity → In use now to focus on occupied targets. Calibration is labeled separately. Totals cover client assignments since this Brain process started, including failed calls after dispatch and routes removed during the session.

The dashboard receives routing snapshots over GET /api/v1/compute/monitoring/models/events as reservations change. It falls back to polling GET /api/v1/compute/monitoring/models every two seconds while the live feed is unavailable. Provider inventory refreshes independently. 4. Open Playground and send a request using the same alias you plan to select in Builder.

small is for lightweight models and smart is for more capable models. The operator decides which models qualify. Brain discovers candidates from matching endpoints, reserves the least busy model, then considers total endpoint load. At equal load, chat uses quality rank for smart and measured speed for both groups. Each speech service rotates between equally loaded model/endpoint pairs, including models on the same server. Rank and available synthesis speed measurements break initial ties. Counters and reservations belong to one server process.

Connect SUSI Builder

In Builder, open Models. The Brain home page shows the values for its current host and deployment prefix. These examples assume the browser and Brain run on the same computer.

Builder setting Provider option Address to enter Model ID
Chat model · API host API endpoint http://127.0.0.1:8042 small or smart
Speech to text · Endpoint URL Via API http://127.0.0.1:8042/v1/audio/transcriptions small or smart
Speech output · Realtime endpoint URL Via API http://127.0.0.1:8042/v1/realtime small or smart

In Chat, Check connection reads the two IDs from GET /v1/models. For speech output, choose Use SUSI Brain and Marin in Builder. Leave the key blank for anonymous loopback access. If Brain requires a SUSI_API_KEY, enter it in Builder. Provider keys belong in Brain's endpoint configuration.

On an Apple Silicon Mac with Ollama 0.40.9 or later running at localhost:11434, the first narration or WAV request automatically prepares phonon:de for German speech. Both small and smart can use it. This default applies to fresh and chat-only installations that omit both compute.tts and compute.speech. Brain checks Ollama for the model, pulls it on demand, and waits before synthesizing. Concurrent requests share a download. Ollama keeps the weights across Brain restarts. A setup failure reaches Builder as a Realtime error with its cause. The German model is distributed under CC BY-NC 4.0. Phonon model card

Saving TTS settings takes precedence over this default. To turn synthesis off, save an empty TTS fleet or set the legacy speech list to [].

For remote Builder clients, use a browser-reachable HTTPS address. Enable WebSocket upgrades on the reverse proxy and send the Realtime secret request and socket to the same Brain process. Brain's default anonymous profile exposes chat, transcription and operator reads. Restrict access at your network or reverse proxy when sharing the host. A configured SUSI key protects configuration writes, file mutations and Realtime grants.

Client API

Operation Endpoint
Discover client model IDs GET /v1/models
Chat, JSON or SSE POST /v1/chat/completions
Transcribe an audio file POST /v1/audio/transcriptions
Obtain a short-lived speech session POST /v1/realtime/client_secrets
Hear speech in Builder WebSocket /v1/realtime?model=small or smart
Download a PCM WAV POST /api/v1/compute/speech
curl http://127.0.0.1:8042/v1/models
curl http://127.0.0.1:8042/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{"model":"small","messages":[{"role":"user","content":"Hello"}]}'
curl http://127.0.0.1:8042/v1/audio/transcriptions -F model=smart -F file=@recording.wav
curl http://127.0.0.1:8042/api/v1/compute/speech \
  -H 'Content-Type: application/json' -d '{"model":"small","input":"Welcome to SUSI."}' -o welcome.wav

The catalogue is stable even during provider outages. Chat returns the requested alias in JSON completions and SSE chunks. Concrete model IDs, provider hostnames and routing assignments are available in operator monitoring. A request returns HTTP 503 when its managed pool has no available, enabled model. Unknown client selectors are rejected. Endpoint credentials stay scoped to the service and URL where they were configured.

Without a managed transcription fleet, small uses local Whisper tiny and smart uses local Whisper base. The first invocation can download weights. Operators can override those choices with compute.builtin_transcription, for example {"small":"tiny","smart":"gpt-transcribe"} with a server-side OPENAI_API_KEY. Saving an explicit STT fleet replaces the built-in routes, including when that fleet is empty.

Existing installations. Older speech routes retain their model IDs, endpoint scopes, rankings and voices. Their former aliases now share the enabled pool. Configuring endpoints: [] on a route turns it off. A route with omitted endpoints applies to every matching endpoint. Use small or smart as the client model ID for either managed speech service. Bookmarks for /configuration.html and /model-routes.html open the chat editor at /chat-configuration.html.

Read the full HTTP contract in the API explorer. The chat access log holds 1,000 requests in memory, newest first. Request history and calibration are separate operator tools.

HTTP request monitoring

Open the [monitoring] section of the web interface for server-wide live requests, the completed-request log and a histogram. The histogram selector offers minute buckets over the last hour, ten-minute buckets over the last day, hour buckets over the last week, and day buckets over the last 30 days. Hover bars for counts or expand the data table. Failed and cancelled/disconnected requests are shown separately in the chart, using labeled status colors. Log pages support method/status filters and newest/newer/older navigation. Monitoring polling can be hidden from these views; process totals always include all recorded traffic. The monitoring APIs are polled only while this view is visible.

Method URL Purpose
GET /api/v1/compute/monitoring/active Process totals and ongoing requests, including streams and cleanup
GET /api/v1/compute/monitoring/requests Newest-completion-first request log with filters and pagination
GET /api/v1/compute/monitoring/chat-requests Newest-arrival-first Chat Completions access log in memory
GET /api/v1/compute/monitoring/histogram Zero-filled UTC completion buckets and aggregate totals
curl 'http://127.0.0.1:8042/api/v1/compute/monitoring/active?exclude_monitoring=true'
curl 'http://127.0.0.1:8042/api/v1/compute/monitoring/requests?limit=50&status_code=500'
curl 'http://127.0.0.1:8042/api/v1/compute/monitoring/histogram?interval=ten_minutes&buckets=144'

An ASGI middleware records requests to the home page, the published HTML pages and traffic under /api and /v1, including unknown API routes, documentation/assets, CORS preflights, validation failures, non-streaming requests and full SSE lifetimes. Monitoring starts when the HTTP server hands the request to ASGI. Active rows include monotonic elapsed time, processing/responding/streaming phase, current HTTP status and body bytes read/sent. Chat rows expose the selected group, concrete model and endpoint ID after selection. A request stays active through ASGI cleanup and is finished exactly once on success, failure, cancellation or disconnect. HTTP statuses >=400 and transport/application failures are failed; cancellation and disconnection are separate states. This describes HTTP delivery, not the semantic success of a model output or an SSE payload.

The daily archive contains only method, matched route template, correlation ID, times, status, state, byte counts and selected proxy target. No request/response content, query strings, credentials, client addresses, actual document paths or raw exception text is retained. Unmatched paths are redacted. id identifies arrival; completion_id identifies completion order. Correlation request_id is nullable for early CORS responses and may be reused by callers; it is not the log key.

Monitor → Chat access log at /chat-requests.html shows up to 1,000 accesses to /v1/chat/completions, newest arrival first. The table includes request time, client IP, requested selector, concrete model, inference endpoint, TTFT, tokens per second, and outcome. In-progress rows update after completion. The client IP comes from the server's client address after trusted proxy handling. The log uses process memory and clears on restart. Filter by outcome or mode, or search for a request ID, IP, agent, model or endpoint. The table shows the snapshot time, retained count and elapsed duration. Show diagnostic columns adds the correlation ID (matching X-Request-ID when available), process-local arrival number, User-Agent, time from arrival to target selection, actual request body size in KiB, and provider-reported input and output token counts. Missing measurements appear as a dash.

TTFT is measured from request arrival to the first streamed text, reasoning, or tool-call delta. Tokens per second uses provider-reported completion tokens over elapsed request time, including discovery and TTFT. A complete JSON reply can have a token rate. TTFT requires streaming; throughput requires a successful reply with usage data. The table distinguishes non-success HTTP statuses, response errors, task cancellation, and client or upstream closure.

Active requests and process totals reset on restart. Each row retains its original instance_id; arrival id is scoped by that instance. Completion IDs continue after the highest valid archived ID, so older-page cursors survive restarts in the same log directory. process_started_at identifies the current process; observed_since is the earliest restored request start, or current startup when there is no history. These boundaries do not attest continuous uptime.

The default archive is logs/compute/requests-YYYY-MM-DD.jsonl. Configure request_log_directory or SUSI_COMPUTE_REQUEST_LOG_DIRECTORY to change it. Paths are relative to the working directory unless absolute. The directory must be outside data_path, since the file service can expose that tree. Files are UTF-8 JSON Lines with sequence, timestamp and safe request data. There is no automatic archive deletion. request_log_capacity, default 10000 (1..100000), bounds the recent RAM cache only; older records remain searchable on disk. retained_requests includes valid archived and buffered rows, cached_requests reports the cache, and evicted_requests is zero for the durable archive.

shared/observability/daily_log.py provides the reusable BufferedDailyLog class:

from susi_brain.shared.observability.daily_log import BufferedDailyLog

with BufferedDailyLog("logs/example", prefix="events") as log:
    log.log({"event": "ready"})
    matches = log.search(query="ready", limit=50)

log(data) accepts a JSON object or string, copies it into RAM and returns a monotonic sequence ID. Its background thread appends the pending batch once every 60 seconds, using O_APPEND; it never rewrites an existing file. Only the UTC date current at flush time is appended. A batch crossing midnight therefore lands in the new day's file while its event timestamps stay unchanged. close(), context exit, normal interpreter exit and application shutdown drain the remainder immediately. An abrupt kill or crash can lose unflushed RAM data. Reads and searches never force an early flush. The class also owns archive/RAM search, exact dictionary filters, exclusions, time ranges and cursor pagination.

One writer owns each directory using a POSIX advisory lock; another writer fails startup rather than mixing independent sequence counters. Separate server workers need separate directories and have independent active counters. Startup streams valid archived rows to reconstruct recent histogram buckets and the cache. Malformed, oversized or incompatible rows are skipped; a truncated tail is kept and separated from the next append. Failed writes retain the buffer; the worker retries on its next minute tick and avoids duplicating complete rows from a partial append. log_status exposes buffered rows, flush interval, last successful batch, append_failed or null, and invalid archive rows skipped at startup.

GET requests also enter this log, including monitoring reads, after completion. exclude_monitoring=true filters monitoring reads from active rows, log pages and histogram totals without turning recording off.

The log accepts limit (1..500, default 100), exclusive completion cursor before, exact uppercase method, status_code (100..599) and route-template path filters. Add q (up to 256 characters) for a case-insensitive literal search of JSON request metadata, since for an inclusive timestamp, and until for an exclusive timestamp. Times must include a timezone, e.g. 2026-10-25T00:00:00Z; a reversed or naive time range returns 422. The web log offers the same text and UTC time filters. Use next_before for an older page; null means no older matching retained rows. Completion cursors remain stable when earlier requests finish late or new calls arrive and remain valid across restart against the same archive. Search runs in FastAPI's worker threads; recent cached pages need no archive reads. Active results accept limit (1..1000, default 100), report filtered active_count and truncated, while their totals always counts all traffic.

Histograms group finished requests by completion time, oldest first, with interval=minute|ten_minutes|hour|day and optional buckets=1..1440. Each resolution retains 1440 time buckets independently of raw-log eviction: one day of minutes, ten days of ten-minute buckets, sixty days of hours and 1440 days of days. Startup reconstructs these windows from valid archive entries, including those older than the recent cache. requests counts all outcomes; errors and cancelled are disjoint subsets. observed=false marks time before the earliest recorded request/startup boundary; partial=true marks a bucket crossing that boundary or the current time. Earlier zero counts do not establish observed idleness. Searches use bounded memory, never call providers and use no additional runtime dependency.

Files and system endpoints

Source checkouts serve files from the project’s data/ directory. Installed packages use data/ in the launch directory. GET /api/v1/compute/data/{path} serves stored bytes, directory links or index.json metadata. A multipart POST with the SUSI Bearer key uploads a file. POST /api/v1/compute/data/search accepts file, query and optional max_rerank, and returns matching JSONL entries in file order. The legacy file DELETE handler currently returns HTTP 500.

Use /api/v1/compute/health/ready for process readiness and /api/v1/compute/system/status.json for host metrics. Provider availability is shown in the service inventory pages.

Endpoint calibration

Calibration runs explicitly through the API and keeps an internal dictionary of results for every selected endpoint/model pair. Startup, ordinary chat and reads do not run calibration. Default scope is the union of smart, small and speech models; scope: "all" selects all models advertised by the selected endpoints. These are real inference calls and can use a hosted provider's credits.

Method URL Purpose
POST /api/v1/compute/calibration Start a background run; returns 202 and a polling Location
GET /api/v1/compute/calibration Read endpoint IDs, progress and model results without triggering work
DELETE /api/v1/compute/calibration Cancel/drain the active run and retain partial results
curl -X POST http://127.0.0.1:8042/api/v1/compute/calibration \
  -H 'Content-Type: application/json' -d '{"scope":"configured"}'
curl http://127.0.0.1:8042/api/v1/compute/calibration

POST also accepts optional endpoint_ids and models arrays. Endpoint IDs come from GET; models are concrete names and must belong to smart/small/speech in configured scope. Filters never introduce arbitrary target URLs or custom prompts. Invalid selections return 422, a concurrent run 409, and an inactive chat transport 503. There is no queue or durable retry deduplication.

The process first discovers models and checks basic chat availability. It then tests three JSON-schema mood classifications (forms), recognition of the packaged number-42 image (vision), and exposed reasoning fields or nonempty think/thinking blocks (thinking). These probes follow Project Euler LLM Benchmark's examples; see src/shared/NOTICE.md for fixture/parser provenance. A false capability means this fixed probe did not demonstrate it; thinking does not attest hidden model reasoning. Null means untested, skipped or inconclusive, with the reason in the corresponding checks entry.

Only after all functional probes finish does the speed phase issue one streaming request per available pair, asking for numbers 1 through 200 with a 256-output-token ceiling. Availability/feature requests use 64/128/512-token ceilings. Probe calls use the same endpoint-specific Bearer keys, TLS verification and HTTP pool as chat, and never provision models or replay a failed generation.

The snapshot also exposes model_groups.smart and model_groups.small as {name, ranking} lists, including before calibration. Models without a configured ranking use zero. speech_models exposes configured {name, voice} entries. Speech records have task: "speech", a measured voice, and speech metadata listing available voices and the proxy's WAV sample format. Speech availability reads Ollama metadata and checks the configured voice. A separate short synthesis must produce valid nonempty PCM WAV before a longer speed sample is allowed. Chat-only feature probes are skipped for speech models. In all scope, /api/show also recognizes additional speech models; models/servers without Ollama speech metadata retain chat probes. All Chat/TTS function probes finish before any speed sample.

Speech speed reports ttfa_seconds until the first complete PCM frame (a header alone does not count), full duration_seconds, audio_duration_seconds derived from actual PCM bytes, and real_time_factor=duration_seconds/audio_duration_seconds. Lower RTF is faster: 0.2 means 2 seconds to produce 10 seconds of audio. Audio probes have a 1 MiB response ceiling and the same configurable per-check deadline as chat. These validate the transport/audio format, not pronunciation, intelligibility or language quality. Each check reserves its endpoint/model for its whole lifetime and releases on timeout/cancellation; forms reserves across its sequential calls, and speech availability includes its metadata read. No API key values or environment-variable names are returned.

The snapshot has run.state, run.phase, progress counters and the current endpoint/model/check, plus results[endpoint_id][model] records containing listed, available, groups, capabilities, checks and metrics. All function checks finish before any speed sample starts. Each record's speed metrics are:

  • ttft_seconds: time from sending the speed request until its first nonempty content or reasoning delta; first_token_kind identifies which. Role-only, empty and keepalive events do not count.
  • tokens_per_second: upstream-reported completion_tokens divided by the full streaming duration, including TTFT. Prompt tokens and transport chunk counts are excluded. Final usage-only frames are retained, following the Chat Completions streaming contract.
  • generation_tokens_per_second: the transport approximation (completion_tokens - 1) / (last_output_time - first_output_time). It is null for unknown token counts, a single output event, or reported hidden reasoning.
  • duration_seconds, generation_seconds, completion_tokens, reasoning_tokens, token_count_source and timing_source expose the basis. Missing usage leaves token rates null while retaining a measured TTFT.

Measurements include network and current server load. A completed run means all probes finished; individual checks may still report rejection, errors or missing support. Truncated/invalid streams do not publish successful speed metrics. Each check has a configurable deadline (default 60 seconds, covering all three forms cases); discovery keeps its separate deadline. The default 1024-pair limit fails excess runs before inference rather than silently omitting models.

Results stay in memory, are replaced when a new run starts, and disappear on restart. Read responses use Cache-Control: no-store. Cancellation and shutdown close upstream responses before releasing the shared HTTP pool. API keys, probe prompts and raw model/reasoning outputs are omitted from the snapshot.

Configuration reference

GET /api/v1/compute/configuration returns the active configuration and an edit revision. PUT saves the endpoints and both chat groups atomically in the project's config.json and applies them to new requests. The file is created on first save outside the public data directory. Provider keys are write-only. If SUSI_API_KEY is set, enter it to save. A stale edit receives HTTP 409. Finish or cancel a running calibration before changing its targets.

The chat configuration response includes a rankings map keyed by lowercase model name. A missing entry means the ranking is unset and the router uses zero. An explicit zero is retained. Send the complete map to update it, omitting a name to clear its ranking. Existing route-level rankings are read automatically. If a legacy configuration gives the same name two ranks, its smart rank takes precedence.

This example routes lightweight chat to either Ollama server and limits the larger model to the second. The speech services have independent pools. Replace the example provider IDs with names advertised by your servers.

{
  "compute": {
    "endpoints": [
      {"provider": "ollama", "url": "http://ollama-a:11434/v1"},
      {"provider": "ollama", "url": "http://ollama-b:11434/v1"}
    ],
    "small": [{"name": "qwen3:8b"}],
    "smart": [{"name": "qwen3:32b", "endpoints": ["http://ollama-b:11434/v1"]}],
    "stt": {
      "endpoints": [{"provider": "openai", "url": "http://asr:8000/v1"}],
      "models": [{"name": "asr-fast"}, {"name": "asr-accurate"}]
    },
    "tts": {
      "endpoints": [{"provider": "openai", "url": "http://voice:8000/v1"}],
      "models": [{"name": "voice-fast", "voice": "coral"},
                 {"name": "voice-hq", "voice": "marin"}]
    }
  }
}

A source checkout uses the project root. A wheel installation uses the launch directory. A legacy --config file can supply startup defaults. The root file takes precedence for saved endpoints, smart, small, rankings, stt and tts settings. Environment and CLI overrides still apply at startup. Unknown fields/groups, duplicate JSON fields and unknown service-prefixed environment variables are rejected. JSON files are limited to 64 KiB. Errors omit submitted values.

susi-brain compute --config config/compute.example.json --port 8043
SUSI_SERVER_PORT=8043 SUSI_COMPUTE_READINESS_TIMEOUT_SECONDS=1 susi-compute
Group Field Default Limits
server host 127.0.0.1 Plain hostname or IP address
server port 8042 1–65535
compute readiness_timeout_seconds 2 Greater than 0, at most 30
compute openai_api_key Empty Cloud audio only; also accepts OPENAI_API_KEY
compute susi_api_key Empty Required for file mutations; also accepts SUSI_API_KEY
compute data_path Project data/ for source starts Explicit values are relative to the working directory or absolute
compute endpoints ["localhost:11434"] Defaults to local Ollama. Set [] for an empty fleet, or specify up to 32 unique host:port strings or {url, provider?, api_key?, api_key_env?} objects
compute smart [] Up to 128 model names or {name, ranking?, endpoints?} objects; highest ranking at equal model and endpoint load
compute small [] Up to 128 model names or {name, ranking?, endpoints?} objects; measured speed at equal model and endpoint load
compute rankings {} Optional finite numeric rank per chat model name, independent of its endpoint assignments
compute stt / tts Unset Each has up to 32 endpoint objects and 128 model routes with optional ranking and endpoint assignments
compute builtin_transcription {"small":"tiny","smart":"base"} Used when no managed STT fleet is configured
compute speech Unset Up to 128 legacy Ollama synthesis models. An explicit empty list disables local synthesis when tts is unset.
compute model_probe_timeout_seconds 3 Greater than 0, at most 30
compute chat_timeout_seconds 120 Greater than 0, at most 600
compute speech_timeout_seconds 120 Upstream operation/idle and first-audio timeout; greater than 0, at most 600
compute calibration_timeout_seconds 60 Deadline per availability/feature/speed check; greater than 0, at most 600
compute calibration_max_pairs 1024 Endpoint/model pairs per run; 1–16384
compute request_log_capacity 10000 Recent completed-request RAM cache; 1–100000, archives remain searchable
compute request_log_directory logs/compute Daily JSONL archive; relative to working directory or absolute, outside data_path

Environment names use SUSI_SERVER_ and SUSI_COMPUTE_ plus the uppercase field. CLI options include --config, --host, --port, --data-path, and the original --openai_api_key/--susi_api_key (also spelled with hyphens). Service-prefixed environment variables override the original environment names; CLI overrides both. Model lists also accept --endpoints, --smart, --small and --speech, each followed by one or more values. --endpoints accepts the short string form; URL/key objects use JSON configuration or SUSI_COMPUTE_ENDPOINTS. Environment list values are JSON arrays, for example SUSI_COMPUTE_SMALL='["your-small-model"]' or SUSI_COMPUTE_ENDPOINTS='[{"url":"https://openrouter.ai/api/v1","api_key_env":"OPENROUTER_API_KEY"}]'.

Verification

python -m pytest
python scripts/export_compute_openapi.py --check
python -m build

The opt-in Mac acceptance test runs two fresh Brain processes against the local Ollama daemon. It sends a German sentence over an anonymous Builder Realtime session, checks for non-silent PCM and verifies that the second process issues no model pull. The first run can install phonon:de. Run it with python -m pytest -qs test/test_local_speech_live.py.

The dependency-free browser stream, timing and audio-input checks additionally run with node --test test/test_chat_stream.mjs test/test_audio_input.mjs test/test_tts.mjs when Node.js is available.

Regenerate the specification after an API change with python scripts/export_compute_openapi.py. Runtime dependencies come from src/requirements.txt; development tools are installed through the pyproject.toml dev extra. Shared modules have no imports from Compute or other applications. The specification is generated from the FastAPI routes and their Pydantic contracts.

The manual test tools have also been updated for this intermediate API. Against a configured running server, from the repository root:

python3.12 test/bin/offline_whisper.py status
python3.12 test/bin/offline_whisper.py openapi
sh test/bin/test_voice.sh
sh test/bin/test_chat.sh
sh test/bin/test_share.sh

Use --base-url http://127.0.0.1:8043 to test a different listener. Audio checks transcribe a real WAV using the small alias by default; pass --model and --file to choose another model or recording. Chat needs a configured model server and matching model group; --chat-model smart|small selects the alias (default small). The file check needs SUSI_API_KEY or --token and exercises upload, read, listing, search and deletion using a unique test path. The file check exposes the inherited DELETE defect described above; it currently fails at deletion and leaves its uniquely named file in data/checks/. all runs every HTTP check. Running offline_whisper.py without arguments retains its original offline Whisper transcription behavior. test/html/test_voice.html retains microphone recording and transcription; WAV fixtures stay in test/wav/.

Docker

docker build -t susi-brain .
docker run --rm -p 127.0.0.1:8042:8042 \
  -e SUSI_CONFIG_DIR=/app/state -v susi-config:/app/state \
  -e OPENAI_API_KEY -e SUSI_API_KEY \
  -v susi-data:/app/data -v susi-logs:/app/logs \
  -v susi-cache:/home/susi/.cache susi-brain

The Python 3.12 slim image installs src/requirements.txt, runs as an unprivileged user, and includes CPU-only Torch, Whisper, Vosk and FFmpeg. The state volume retains config.json across container replacements. Other volumes retain files, request history and model weights. Mount the configuration directory as a unit so atomic saves can replace the file. Models load/download on first transcription; neither startup nor image creation downloads model weights.

排名相邻

AI Rank iPhone 版

随时追踪 AI 模型榜单

在 App Store 下载