# pypy66/sider-ai-api architecture

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

- Interactive diagram: https://gitdiagram.com/pypy66/sider-ai-api
- Repository: https://github.com/pypy66/sider-ai-api

## Overview

sider_ai_api is a compact Python client for Sider.ai. Its principal workflow is to create an authenticated Session, submit chat or image-OCR input, and consume streamed text while conversation and quota state are updated. The same Session also exposes translation, deep search, and grammar improvement. The excerpts show authentication setup, OCR upload, and several calls into the shared response parser; other request details are omitted, so those links are not inferred.

Main entry points: [`sider_ai_api.py`](https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py) (Response streaming)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_session["Session setup"]
  node_session["Authenticated session<br/>[sider_ai_api.py]"]
  node_auth["Token and cookie<br/>[sider_ai_api.py]"]
end

subgraph group_features["AI features"]
  node_chat["Chat<br/>[sider_ai_api.py]"]
  node_ocr["Image OCR<br/>[sider_ai_api.py]"]
  node_translation["Translation<br/>[sider_ai_api.py]"]
  node_search["Deep search<br/>[sider_ai_api.py]"]
  node_grammar["Grammar improvement<br/>[sider_ai_api.py]"]
end

subgraph group_transport["Request handling"]
  node_upload["Image upload<br/>[sider_ai_api.py]"]
  node_stream["Response streaming<br/>[sider_ai_api.py]"]
end

node_user(("Library user"))
node_sider["Sider API"]

node_user -->|"creates"| node_session
node_session -->|"loads credentials"| node_auth
node_user -->|"submits prompt"| node_chat
node_user -->|"submits image"| node_ocr
node_user -->|"requests translation"| node_translation
node_user -->|"requests search"| node_search
node_user -->|"requests improvement"| node_grammar
node_ocr -->|"uploads image"| node_upload
node_chat -->|"parses response"| node_stream
node_ocr -->|"parses response"| node_stream
node_translation -->|"parses response"| node_stream
node_search -->|"parses response"| node_stream
node_grammar -->|"parses response"| node_stream
node_chat -.->|"calls service"| node_sider
node_ocr -.->|"calls service"| node_sider
node_translation -.->|"calls service"| node_sider
node_search -.->|"calls service"| node_sider
node_grammar -.->|"calls service"| node_sider

click node_session "https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py"
click node_auth "https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py"
click node_chat "https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py"
click node_ocr "https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py"
click node_translation "https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py"
click node_search "https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py"
click node_grammar "https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py"
click node_upload "https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py"
click node_stream "https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.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_session,node_auth,node_user toneBlue
class node_chat,node_ocr,node_translation,node_search,node_grammar toneAmber
class node_upload,node_stream,node_sider toneMint
```

## Components

### Session setup

- [Authenticated session](https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py): `sider_ai_api.py`
- [Token and cookie](https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py): `sider_ai_api.py`

### AI features

- [Chat](https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py): `sider_ai_api.py`
- [Image OCR](https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py): `sider_ai_api.py`
- [Translation](https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py): `sider_ai_api.py`
- [Deep search](https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py): `sider_ai_api.py`
- [Grammar improvement](https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py): `sider_ai_api.py`

### Request handling

- [Image upload](https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py): `sider_ai_api.py`
- [Response streaming](https://github.com/pypy66/sider-ai-api/blob/main/sider_ai_api.py): `sider_ai_api.py`

### Other components

- **Library user**
- **Sider API**

## Connections

- Library user → Authenticated session: creates (evidence: `README.md`)
- Authenticated session → Token and cookie: loads credentials (evidence: `sider_ai_api.py`)
- Library user → Chat: submits prompt (evidence: `README.md`)
- Library user → Image OCR: submits image (evidence: `README.md`)
- Library user → Translation: requests translation (evidence: `sider_ai_api.py`)
- Library user → Deep search: requests search (evidence: `sider_ai_api.py`)
- Library user → Grammar improvement: requests improvement (evidence: `sider_ai_api.py`)
- Image OCR → Image upload: uploads image (evidence: `sider_ai_api.py`)
- Chat → Response streaming: parses response (evidence: `sider_ai_api.py`)
- Image OCR → Response streaming: parses response (evidence: `sider_ai_api.py`)
- Translation → Response streaming: parses response (evidence: `sider_ai_api.py`)
- Deep search → Response streaming: parses response (evidence: `sider_ai_api.py`)
- Grammar improvement → Response streaming: parses response (evidence: `sider_ai_api.py`)
- Chat → Sider API: calls service
- Image OCR → Sider API: calls service
- Translation → Sider API: calls service
- Deep search → Sider API: calls service
- Grammar improvement → Sider API: calls service
