# argmaxinc/argmax-oss-swift architecture

> Architecture diagram of the GitHub repository argmaxinc/argmax-oss-swift, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/argmaxinc/argmax-oss-swift
- Repository: https://github.com/argmaxinc/argmax-oss-swift

## Overview

Argmax Open-Source SDK packages three on-device inference workflows: WhisperKit transcription, SpeakerKit diarization, and TTSKit speech generation, with a CLI and local transcription server as user-facing entry points. Shared ArgmaxCore handles model resolution/loading and tokenization. The graph follows documented workflows and relationships named by the SOURCE INDEX; unsampled implementation details are not expanded into speculative call chains.

Main entry points: [`Sources/WhisperKit/Core/WhisperKit.swift`](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/WhisperKit/Core/WhisperKit.swift) (WhisperKit), [`Sources/SpeakerKit/SpeakerKit.swift`](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/SpeakerKit/SpeakerKit.swift) (SpeakerKit), [`Sources/TTSKit/TTSKit.swift`](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/TTSKit/TTSKit.swift) (TTSKit), [`Sources/ArgmaxCLI/TranscribeCLI.swift`](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCLI/TranscribeCLI.swift) (Transcribe command)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_cli["Argmax CLI<br/>[ArgmaxCLI.swift]"]
  node_transcribe_cli["Transcribe command"]
  node_server["Local API server<br/>[Server.swift]"]
  node_openai_handler["OpenAI handler"]
  node_tts_cli["TTS command<br/>[TTSCLI.swift]"]
end

subgraph group_shared["Shared model services"]
  node_core_manager["Model manager<br/>[ModelManager.swift]"]
  node_model_downloader["Model downloader"]
  node_hub_api["Hub API<br/>[HubApi.swift]"]
  node_hub_config["Hub configuration<br/>[Config.swift]"]
  node_tokenizer["Tokenizer<br/>[Tokenizer.swift]"]
end

subgraph group_whisper["Transcription"]
  node_whisperkit["WhisperKit<br/>[WhisperKit.swift]"]
  node_audio_processor["Audio processing"]
  node_text_decoder["Text decoding<br/>[TextDecoder.swift]"]
  node_transcription_results["Transcription results"]
end

subgraph group_speaker["Speaker diarization"]
  node_speakerkit["SpeakerKit<br/>[SpeakerKit.swift]"]
  node_pyannote_manager["Pyannote models"]
  node_diarization_result["Diarization results"]
end

subgraph group_tts["Speech generation"]
  node_ttskit["TTSKit<br/>[TTSKit.swift]"]
  node_qwen_task["Qwen generation"]
  node_audio_output["Audio output<br/>[AudioOutput.swift]"]
end

node_user(("App or user"))

node_user -->|"runs"| node_cli
node_cli -->|"dispatches"| node_transcribe_cli
node_user -->|"sends requests"| node_server
node_server -.->|"routes to"| node_openai_handler
node_openai_handler -->|"transcribes with"| node_whisperkit
node_transcribe_cli -->|"transcribes with"| node_whisperkit
node_transcribe_cli -->|"diarizes with"| node_speakerkit
node_whisperkit -->|"loads audio"| node_audio_processor
node_whisperkit -->|"decodes text"| node_text_decoder
node_whisperkit -->|"produces results"| node_transcription_results
node_speakerkit -->|"loads models"| node_pyannote_manager
node_speakerkit -->|"returns diarization"| node_diarization_result
node_speakerkit -->|"aligns speakers"| node_transcription_results
node_user -->|"runs"| node_tts_cli
node_tts_cli -->|"generates with"| node_ttskit
node_tts_cli -->|"plays or saves"| node_audio_output
node_ttskit -->|"generates speech"| node_qwen_task
node_ttskit -->|"plays audio"| node_audio_output
node_core_manager -->|"resolves models"| node_model_downloader
node_model_downloader -->|"fetches model files"| node_hub_api
node_hub_api -->|"uses configuration"| node_hub_config
node_whisperkit -.->|"manages model state"| node_core_manager
node_speakerkit -->|"uses model manager"| node_core_manager
node_ttskit -->|"downloads models"| node_model_downloader
node_whisperkit -->|"loads tokenizer"| node_tokenizer
node_ttskit -->|"loads tokenizer"| node_tokenizer

click node_cli "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCLI/ArgmaxCLI.swift"
click node_transcribe_cli "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCLI/TranscribeCLI.swift"
click node_server "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCLI/Server/GeneratedSources/Server.swift"
click node_openai_handler "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCLI/Server/OpenAIHandler.swift"
click node_core_manager "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCore/ModelManager.swift"
click node_model_downloader "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCore/ModelDownloader.swift"
click node_hub_api "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCore/External/Hub/HubApi.swift"
click node_hub_config "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCore/External/Hub/Config.swift"
click node_tokenizer "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCore/External/Tokenizers/Tokenizer.swift"
click node_whisperkit "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/WhisperKit/Core/WhisperKit.swift"
click node_audio_processor "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/WhisperKit/Core/Audio/AudioProcessor.swift"
click node_text_decoder "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/WhisperKit/Core/TextDecoder.swift"
click node_transcription_results "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/WhisperKit/Utilities/TranscriptionUtilities.swift"
click node_speakerkit "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/SpeakerKit/SpeakerKit.swift"
click node_pyannote_manager "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/SpeakerKit/Pyannote/PyannoteModelManager.swift"
click node_diarization_result "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/SpeakerKit/DiarizationResult.swift"
click node_tts_cli "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCLI/TTSCLI.swift"
click node_ttskit "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/TTSKit/TTSKit.swift"
click node_qwen_task "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/TTSKit/Qwen3TTS/Qwen3GenerateTask.swift"
click node_audio_output "https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/TTSKit/Utilities/AudioOutput.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_transcribe_cli,node_server,node_openai_handler,node_tts_cli,node_user toneBlue
class node_core_manager,node_model_downloader,node_hub_api,node_hub_config,node_tokenizer toneAmber
class node_whisperkit,node_audio_processor,node_text_decoder,node_transcription_results toneMint
class node_speakerkit,node_pyannote_manager,node_diarization_result toneRose
class node_ttskit,node_qwen_task,node_audio_output toneIndigo
```

## Components

### User interfaces

- [Argmax CLI](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCLI/ArgmaxCLI.swift): `Sources/ArgmaxCLI/ArgmaxCLI.swift`
- [Transcribe command](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCLI/TranscribeCLI.swift): `Sources/ArgmaxCLI/TranscribeCLI.swift`
- [Local API server](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCLI/Server/GeneratedSources/Server.swift): `Sources/ArgmaxCLI/Server/GeneratedSources/Server.swift`
- [OpenAI handler](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCLI/Server/OpenAIHandler.swift): `Sources/ArgmaxCLI/Server/OpenAIHandler.swift`
- [TTS command](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCLI/TTSCLI.swift): `Sources/ArgmaxCLI/TTSCLI.swift`

### Shared model services

- [Model manager](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCore/ModelManager.swift): `Sources/ArgmaxCore/ModelManager.swift`
- [Model downloader](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCore/ModelDownloader.swift): `Sources/ArgmaxCore/ModelDownloader.swift`
- [Hub API](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCore/External/Hub/HubApi.swift): `Sources/ArgmaxCore/External/Hub/HubApi.swift`
- [Hub configuration](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCore/External/Hub/Config.swift): `Sources/ArgmaxCore/External/Hub/Config.swift`
- [Tokenizer](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/ArgmaxCore/External/Tokenizers/Tokenizer.swift): `Sources/ArgmaxCore/External/Tokenizers/Tokenizer.swift`

### Transcription

- [WhisperKit](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/WhisperKit/Core/WhisperKit.swift): `Sources/WhisperKit/Core/WhisperKit.swift`
- [Audio processing](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/WhisperKit/Core/Audio/AudioProcessor.swift): `Sources/WhisperKit/Core/Audio/AudioProcessor.swift`
- [Text decoding](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/WhisperKit/Core/TextDecoder.swift): `Sources/WhisperKit/Core/TextDecoder.swift`
- [Transcription results](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/WhisperKit/Utilities/TranscriptionUtilities.swift): `Sources/WhisperKit/Utilities/TranscriptionUtilities.swift`

### Speaker diarization

- [SpeakerKit](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/SpeakerKit/SpeakerKit.swift): `Sources/SpeakerKit/SpeakerKit.swift`
- [Pyannote models](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/SpeakerKit/Pyannote/PyannoteModelManager.swift): `Sources/SpeakerKit/Pyannote/PyannoteModelManager.swift`
- [Diarization results](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/SpeakerKit/DiarizationResult.swift): `Sources/SpeakerKit/DiarizationResult.swift`

### Speech generation

- [TTSKit](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/TTSKit/TTSKit.swift): `Sources/TTSKit/TTSKit.swift`
- [Qwen generation](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/TTSKit/Qwen3TTS/Qwen3GenerateTask.swift): `Sources/TTSKit/Qwen3TTS/Qwen3GenerateTask.swift`
- [Audio output](https://github.com/argmaxinc/argmax-oss-swift/blob/main/Sources/TTSKit/Utilities/AudioOutput.swift): `Sources/TTSKit/Utilities/AudioOutput.swift`

### Other components

- **App or user**

## Connections

- App or user → Argmax CLI: runs (evidence: `README.md`)
- Argmax CLI → Transcribe command: dispatches (evidence: `Sources/ArgmaxCLI/ArgmaxCLI.swift`)
- App or user → Local API server: sends requests (evidence: `README.md`)
- Local API server → OpenAI handler: routes to
- OpenAI handler → WhisperKit: transcribes with (evidence: `Sources/ArgmaxCLI/Server/OpenAIHandler.swift`)
- Transcribe command → WhisperKit: transcribes with (evidence: `Sources/ArgmaxCLI/TranscribeCLI.swift`)
- Transcribe command → SpeakerKit: diarizes with (evidence: `Sources/ArgmaxCLI/TranscribeCLI.swift`)
- WhisperKit → Audio processing: loads audio (evidence: `Sources/WhisperKit/Core/WhisperKit.swift`)
- WhisperKit → Text decoding: decodes text (evidence: `Sources/WhisperKit/Core/WhisperKit.swift`)
- WhisperKit → Transcription results: produces results (evidence: `Sources/WhisperKit/Core/WhisperKit.swift`)
- SpeakerKit → Pyannote models: loads models (evidence: `Sources/SpeakerKit/Pyannote/PyannoteModelManager.swift`)
- SpeakerKit → Diarization results: returns diarization (evidence: `Sources/SpeakerKit/SpeakerKit.swift`)
- SpeakerKit → Transcription results: aligns speakers
- App or user → TTS command: runs (evidence: `README.md`)
- TTS command → TTSKit: generates with (evidence: `Sources/ArgmaxCLI/TTSCLI.swift`)
- TTS command → Audio output: plays or saves (evidence: `Sources/ArgmaxCLI/TTSCLI.swift`)
- TTSKit → Qwen generation: generates speech (evidence: `Sources/TTSKit/TTSKit.swift`)
- TTSKit → Audio output: plays audio (evidence: `Sources/TTSKit/TTSKit.swift`)
- Model manager → Model downloader: resolves models (evidence: `Sources/ArgmaxCore/ModelManager.swift`)
- Model downloader → Hub API: fetches model files (evidence: `Sources/ArgmaxCore/ModelDownloader.swift`)
- Hub API → Hub configuration: uses configuration (evidence: `Sources/ArgmaxCore/External/Hub/HubApi.swift`)
- WhisperKit → Model manager: manages model state
- SpeakerKit → Model manager: uses model manager (evidence: `Sources/SpeakerKit/SpeakerKit.swift`)
- TTSKit → Model downloader: downloads models (evidence: `Sources/TTSKit/TTSKit.swift`)
- WhisperKit → Tokenizer: loads tokenizer (evidence: `Sources/WhisperKit/Core/WhisperKit.swift`)
- TTSKit → Tokenizer: loads tokenizer (evidence: `Sources/TTSKit/TTSKit.swift`)
