Files
Hanzo Dev 47286f0b70 koma: the model card, the API contract and one example
Koma is Hanzo's image model, served at api.hanzo.ai under the id `koma` on the
OpenAI images schema. This repository is its card: what it renders, what it
prices at, the shapes it answers, and what is deliberately absent (edits, video,
n > 1).

The card states the sizes callers actually ask for against the shapes the render
ladder can draw, because they are not the same set — 1792x1024 and 1024x1792 are
the two most requested shapes in the API and both are past the pixel budget, so
Koma fits rather than refuses. LLM.md records the fitting rule and how to verify
a deploy.

The upstreams that render Koma are not named anywhere in this repository: Koma is
sold as Koma. hanzo.yml declares no image and no test gate, because nothing runs
from here — the SKU lives in hanzo/universe's zen catalog and is served by
hanzo-inc/zen.
2026-10-27 15:57:19 -07:00

31 lines
1.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Render one image with Koma — the smallest complete call.
#
# HANZO_API_KEY=... ./examples/generate.sh "a red cube on a white table" 1792x1024
#
# Writes /tmp/koma.jpg and prints its size. A 422 naming a pixel count or a list
# of legal edges means the deployed zen predates size fitting; see LLM.md.
set -euo pipefail
prompt=${1:?usage: generate.sh <prompt> [WxH]}
size=${2:-1024x1024}
: "${HANZO_API_KEY:?set HANZO_API_KEY (https://platform.hanzo.ai → API keys)}"
body=$(printf '{"model":"koma","prompt":%s,"size":"%s"}' \
"$(printf '%s' "$prompt" | python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))')" \
"$size")
curl -sS https://api.hanzo.ai/v1/images/generations \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d "$body" \
| python3 -c '
import base64, json, sys
d = json.load(sys.stdin)
if "data" not in d:
sys.exit("koma refused: " + json.dumps(d)[:400])
open("/tmp/koma.jpg", "wb").write(base64.b64decode(d["data"][0]["b64_json"]))
'
file /tmp/koma.jpg