# gufo-org/gufo architecture

> Architecture diagram of the GitHub repository gufo-org/gufo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gufo-org/gufo
- Repository: https://github.com/gufo-org/gufo

## Overview

Gufo is a single-machine AMD Strix Halo inference engine exposed through a CLI and OpenAI-compatible server. The principal workflow is a client request entering the server, reaching a model-specific inference backend, and returning generated or multimodal results; separate CLI commands manage models and extensions. The architecture also includes request caching and shared GPU/memory infrastructure. README capabilities guide the unsampled branches; edges without a shown caller relationship are dashed and marked unverified.

Main entry points: [`src/cli/serve/http_server.cpp`](https://github.com/gufo-org/gufo/blob/main/src/cli/serve/http_server.cpp) (HTTP server), [`src/cli/main.cpp`](https://github.com/gufo-org/gufo/blob/main/src/cli/main.cpp) (Gufo CLI), [`src/cli/serve/openai_chat.cpp`](https://github.com/gufo-org/gufo/blob/main/src/cli/serve/openai_chat.cpp) (Text serving), [`src/core/hip/copy_engine.cpp`](https://github.com/gufo-org/gufo/blob/main/src/core/hip/copy_engine.cpp) (GPU memory and copies)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and serving"]
  node_cli["Gufo CLI<br/>[main.cpp]"]
  node_http["HTTP server<br/>[http_server.cpp]"]
  node_text_api["Text serving<br/>[openai_chat.cpp]"]
  node_audio_api["Audio serving<br/>[asr_service.cpp]"]
  node_image_api["Image serving<br/>[image_api.cpp]"]
  node_video_api["Video serving<br/>[video_api.cpp]"]
  node_embed_api["Embedding service"]
end

subgraph group_models["Inference capabilities"]
  node_qwen_model["Qwen text model"]
  node_deepseek_model["DeepSeek model<br/>[engine.cpp]"]
  node_image_model["Image generation<br/>[pipeline.cpp]"]
  node_embedding_model["Embedding models"]
  node_multimodal_models["Speech and video models"]
end

subgraph group_runtime["Runtime services"]
  node_cache[("Inference cache<br/>[disk.cpp]")]
  node_gpu_memory["GPU memory and copies<br/>[copy_engine.cpp]"]
  node_diagnostics["Device diagnostics"]
end

subgraph group_management["Model and extensions"]
  node_model_management["Model management<br/>[model.cpp]"]
  node_extensions["Extensions<br/>[extension.cpp]"]
  node_extension_registry["Extension registry<br/>[registry.hpp]"]
end

node_user(("CLI user"))
node_client(("API client"))

node_user -->|"runs commands"| node_cli
node_cli -.->|"starts server"| node_http
node_client -->|"sends requests"| node_http
node_http -.->|"routes requests"| node_text_api
node_http -.->|"routes requests"| node_audio_api
node_http -.->|"routes requests"| node_image_api
node_http -.->|"routes requests"| node_video_api
node_http -.->|"routes requests"| node_embed_api
node_text_api -.->|"runs inference"| node_qwen_model
node_text_api -.->|"runs inference"| node_deepseek_model
node_image_api -.->|"runs generation"| node_image_model
node_embed_api -.->|"creates embeddings"| node_embedding_model
node_audio_api -.->|"runs speech models"| node_multimodal_models
node_video_api -.->|"runs video models"| node_multimodal_models
node_text_api -.->|"uses cache"| node_cache
node_qwen_model -.->|"uses GPU memory"| node_gpu_memory
node_deepseek_model -.->|"uses GPU memory"| node_gpu_memory
node_image_model -.->|"uses GPU memory"| node_gpu_memory
node_cli -->|"dispatches commands"| node_model_management
node_cli -->|"dispatches commands"| node_extensions
node_extensions -.->|"uses API registry"| node_extension_registry
node_cli -.->|"runs diagnostics"| node_diagnostics

click node_cli "https://github.com/gufo-org/gufo/blob/main/src/cli/main.cpp"
click node_http "https://github.com/gufo-org/gufo/blob/main/src/cli/serve/http_server.cpp"
click node_text_api "https://github.com/gufo-org/gufo/blob/main/src/cli/serve/openai_chat.cpp"
click node_audio_api "https://github.com/gufo-org/gufo/blob/main/src/cli/serve/asr_service.cpp"
click node_image_api "https://github.com/gufo-org/gufo/blob/main/src/cli/serve/image_api.cpp"
click node_video_api "https://github.com/gufo-org/gufo/blob/main/src/cli/serve/video_api.cpp"
click node_embed_api "https://github.com/gufo-org/gufo/blob/main/src/cli/serve/embedding_service.cpp"
click node_qwen_model "https://github.com/gufo-org/gufo/tree/main/src/models"
click node_deepseek_model "https://github.com/gufo-org/gufo/blob/main/src/models/deepseek_v4_flash/engine.cpp"
click node_image_model "https://github.com/gufo-org/gufo/blob/main/src/models/qwen_image_21/hip/pipeline.cpp"
click node_embedding_model "https://github.com/gufo-org/gufo/tree/main/src/models/embedding_gemma2"
click node_multimodal_models "https://github.com/gufo-org/gufo/tree/main/src/models"
click node_cache "https://github.com/gufo-org/gufo/blob/main/src/cache/disk.cpp"
click node_gpu_memory "https://github.com/gufo-org/gufo/blob/main/src/core/hip/copy_engine.cpp"
click node_diagnostics "https://github.com/gufo-org/gufo/tree/main/src/core/diagnostics"
click node_model_management "https://github.com/gufo-org/gufo/blob/main/src/cli/model/model.cpp"
click node_extensions "https://github.com/gufo-org/gufo/blob/main/src/cli/extension/extension.cpp"
click node_extension_registry "https://github.com/gufo-org/gufo/blob/main/include/gufo/ext/registry.hpp"

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_http,node_text_api,node_audio_api,node_image_api,node_video_api,node_embed_api,node_user,node_client toneBlue
class node_qwen_model,node_deepseek_model,node_image_model,node_embedding_model,node_multimodal_models toneAmber
class node_cache,node_gpu_memory,node_diagnostics toneMint
class node_model_management,node_extensions,node_extension_registry toneRose
```

## Components

### CLI and serving

- [Gufo CLI](https://github.com/gufo-org/gufo/blob/main/src/cli/main.cpp): `src/cli/main.cpp`
- [HTTP server](https://github.com/gufo-org/gufo/blob/main/src/cli/serve/http_server.cpp): `src/cli/serve/http_server.cpp`
- [Text serving](https://github.com/gufo-org/gufo/blob/main/src/cli/serve/openai_chat.cpp): `src/cli/serve/openai_chat.cpp`
- [Audio serving](https://github.com/gufo-org/gufo/blob/main/src/cli/serve/asr_service.cpp): `src/cli/serve/asr_service.cpp`
- [Image serving](https://github.com/gufo-org/gufo/blob/main/src/cli/serve/image_api.cpp): `src/cli/serve/image_api.cpp`
- [Video serving](https://github.com/gufo-org/gufo/blob/main/src/cli/serve/video_api.cpp): `src/cli/serve/video_api.cpp`
- [Embedding service](https://github.com/gufo-org/gufo/blob/main/src/cli/serve/embedding_service.cpp): `src/cli/serve/embedding_service.cpp`

### Inference capabilities

- [Qwen text model](https://github.com/gufo-org/gufo/tree/main/src/models): `src/models`
- [DeepSeek model](https://github.com/gufo-org/gufo/blob/main/src/models/deepseek_v4_flash/engine.cpp): `src/models/deepseek_v4_flash/engine.cpp`
- [Image generation](https://github.com/gufo-org/gufo/blob/main/src/models/qwen_image_21/hip/pipeline.cpp): `src/models/qwen_image_21/hip/pipeline.cpp`
- [Embedding models](https://github.com/gufo-org/gufo/tree/main/src/models/embedding_gemma2): `src/models/embedding_gemma2`
- [Speech and video models](https://github.com/gufo-org/gufo/tree/main/src/models): `src/models`

### Runtime services

- [Inference cache](https://github.com/gufo-org/gufo/blob/main/src/cache/disk.cpp): `src/cache/disk.cpp`
- [GPU memory and copies](https://github.com/gufo-org/gufo/blob/main/src/core/hip/copy_engine.cpp): `src/core/hip/copy_engine.cpp`
- [Device diagnostics](https://github.com/gufo-org/gufo/tree/main/src/core/diagnostics): `src/core/diagnostics`

### Model and extensions

- [Model management](https://github.com/gufo-org/gufo/blob/main/src/cli/model/model.cpp): `src/cli/model/model.cpp`
- [Extensions](https://github.com/gufo-org/gufo/blob/main/src/cli/extension/extension.cpp): `src/cli/extension/extension.cpp`
- [Extension registry](https://github.com/gufo-org/gufo/blob/main/include/gufo/ext/registry.hpp): `include/gufo/ext/registry.hpp`

### Other components

- **CLI user**
- **API client**

## Connections

- CLI user → Gufo CLI: runs commands (evidence: `README.md`)
- Gufo CLI → HTTP server: starts server
- API client → HTTP server: sends requests (evidence: `README.md`)
- HTTP server → Text serving: routes requests
- HTTP server → Audio serving: routes requests
- HTTP server → Image serving: routes requests
- HTTP server → Video serving: routes requests
- HTTP server → Embedding service: routes requests
- Text serving → Qwen text model: runs inference
- Text serving → DeepSeek model: runs inference
- Image serving → Image generation: runs generation
- Embedding service → Embedding models: creates embeddings
- Audio serving → Speech and video models: runs speech models
- Video serving → Speech and video models: runs video models
- Text serving → Inference cache: uses cache
- Qwen text model → GPU memory and copies: uses GPU memory
- DeepSeek model → GPU memory and copies: uses GPU memory
- Image generation → GPU memory and copies: uses GPU memory
- Gufo CLI → Model management: dispatches commands (evidence: `src/cli/main.cpp`)
- Gufo CLI → Extensions: dispatches commands (evidence: `src/cli/main.cpp`)
- Extensions → Extension registry: uses API registry
- Gufo CLI → Device diagnostics: runs diagnostics
