wassemgtk's picture
Deploy GLM visual runtime gateway MVP
df76dfd verified
|
Raw
History Blame Contribute Delete
1.87 kB
metadata
title: GLM Visual Variable Runtime
emoji: 👁️
colorFrom: indigo
colorTo: blue
sdk: docker
app_port: 8000
short_description: OpenAI-compatible visual runtime gateway

GLM Visual Variable Runtime

glm-5.2-visual-runtime is a training-free multimodal gateway that exposes an OpenAI-compatible API while using GLM-5.2 as the reasoning engine and lazy visual lenses for images, OCR, palettes, objects, charts, and presentations.

The MVP in this repository is contract-first:

  • FastAPI endpoints for /v1/responses, /v1/chat/completions, /v1/files, /health, and /ready.
  • Persistent visual assets with hash-based deduplication and lazy cached views.
  • Deterministic test mode providers, plus replaceable interfaces for GLM-5.2, GLM-5V-Turbo, and GLM-OCR.
  • CPU-only ingest fingerprinting with Pillow, OpenCV, and NumPy.
  • A TypeScript PptxGenJS renderer service for editable PowerPoint artifacts.
  • No training, no fine-tuning, and no GLM-5.2 self-hosting.

Quick Start

cp .env.example .env
docker compose up --build

API docs are available at http://localhost:8000/docs.

Local Tests

cd apps/api
python3 -m venv .venv
. .venv/bin/activate
pip install -e ".[test]"
pytest ../../tests

Example

from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="test")
response = client.responses.create(
    model="glm-5.2-visual-runtime",
    input=[{
        "role": "user",
        "content": [{"type": "input_text", "text": "Hello"}],
    }],
)
print(response.output_text)

Hugging Face Space

The deployment target is a Docker Space. Set the following secrets in the Space for cloud mode:

  • GLM_API_KEY
  • VISION_API_KEY
  • OCR_API_KEY
  • object store and database credentials

Without secrets, set VISUAL_RUNTIME_MODE=test to use deterministic fake providers.