# b0red-man/gem-live-text architecture

> Architecture diagram of the GitHub repository b0red-man/gem-live-text, 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/b0red-man/gem-live-text
- Repository: https://github.com/b0red-man/gem-live-text

## Overview

gem-live-text is a small FastAPI wrapper that exposes Gemini Live models through OpenAI-compatible endpoints. The principal workflow authenticates and validates a chat request, translates its messages and options into Gemini Live configuration, sends the turn to Gemini, then formats text or function-call events as a regular completion or an SSE stream. A separate endpoint lists supported models. The single-file implementation is shown at its actual function-level stages; no separate storage layer is present. Relationships are based on the README and the excerpted main.py.

Main entry points: [`main.py`](https://github.com/b0red-man/gem-live-text/blob/master/main.py) (Chat Endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["OpenAI API"]
  node_auth["Bearer Auth<br/>[main.py]"]
  node_models["Model Listing<br/>[main.py]"]
  node_chat["Chat Endpoint<br/>[main.py]"]
  node_response["Completion Formatting<br/>[main.py]"]
end

subgraph group_translation["Request Translation"]
  node_request_build["Request Builder<br/>[main.py]"]
end

subgraph group_live["Gemini Live"]
  node_live_generate["Live Generation<br/>[main.py]"]
end

node_caller(("API Client"))
node_gemini{{"Gemini Live API"}}

node_caller -->|"requests models"| node_models
node_caller -->|"submits chat"| node_chat
node_models -->|"requires"| node_auth
node_chat -->|"requires"| node_auth
node_chat -->|"builds config"| node_request_build
node_chat -->|"generates"| node_live_generate
node_request_build -->|"provides turns"| node_live_generate
node_live_generate -->|"sends turn"| node_gemini
node_live_generate -->|"yields events"| node_response
node_chat -->|"formats result"| node_response

click node_auth "https://github.com/b0red-man/gem-live-text/blob/master/main.py"
click node_models "https://github.com/b0red-man/gem-live-text/blob/master/main.py"
click node_chat "https://github.com/b0red-man/gem-live-text/blob/master/main.py"
click node_response "https://github.com/b0red-man/gem-live-text/blob/master/main.py"
click node_request_build "https://github.com/b0red-man/gem-live-text/blob/master/main.py"
click node_live_generate "https://github.com/b0red-man/gem-live-text/blob/master/main.py"

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_auth,node_models,node_chat,node_response,node_caller toneBlue
class node_request_build toneAmber
class node_live_generate,node_gemini toneMint
```

## Components

### OpenAI API

- [Bearer Auth](https://github.com/b0red-man/gem-live-text/blob/master/main.py): `main.py`
- [Model Listing](https://github.com/b0red-man/gem-live-text/blob/master/main.py): `main.py`
- [Chat Endpoint](https://github.com/b0red-man/gem-live-text/blob/master/main.py): `main.py`
- [Completion Formatting](https://github.com/b0red-man/gem-live-text/blob/master/main.py): `main.py`

### Request Translation

- [Request Builder](https://github.com/b0red-man/gem-live-text/blob/master/main.py): `main.py`

### Gemini Live

- [Live Generation](https://github.com/b0red-man/gem-live-text/blob/master/main.py): `main.py`

### Other components

- **API Client**
- **Gemini Live API**

## Connections

- API Client → Model Listing: requests models (evidence: `README.md`)
- API Client → Chat Endpoint: submits chat (evidence: `README.md`)
- Model Listing → Bearer Auth: requires (evidence: `main.py`)
- Chat Endpoint → Bearer Auth: requires (evidence: `main.py`)
- Chat Endpoint → Request Builder: builds config (evidence: `main.py`)
- Chat Endpoint → Live Generation: generates (evidence: `main.py`)
- Request Builder → Live Generation: provides turns (evidence: `main.py`)
- Live Generation → Gemini Live API: sends turn (evidence: `main.py`)
- Live Generation → Completion Formatting: yields events (evidence: `main.py`)
- Chat Endpoint → Completion Formatting: formats result (evidence: `main.py`)
