Parallel OpenSCAD code-generation pipeline across multiple LLM models, with headless STL compilation, error-feedback refinement, multi-angle snapshots, vision-LLM review, an optional closed-loop refinement round, and a minimal static website with an interactive 3D viewer for comparing model performance.
See PLAN.md for the full design.
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
cp config.example.jsonc config.jsonc # edit if needed
export OPENCODE_API_KEY=... # your zen endpoint keyRequires openscad on PATH (headless). No other system packages.
# Inspect available models without spending:
cow-factory --list-models
# Preview the run plan:
cow-factory --dry-run
# Full run (all discovered models, 3 variations each, 1 refine round):
cow-factory run
# Scope to a few models + 1 variation for a quick test:
cow-factory run --whitelist gpt-4o,kimi-k2 --variations 1Output lands in runs/<timestamp>/; the static site is built at out/site/.
Serve it with any static file server, e.g. python3 -m http.server -d out/site.
prompt → [Stage 1] parallel code-gen (M models × K variations)
→ [Stage 2] openscad -o model.stl (refine on stderr, max R iters)
→ [Stage 3] 6-angle PNG snapshots
→ [Stage 4] vision-LLM review → {score, issues, refinement_prompt}
→ [Round 2] re-generate with refinement_prompt (optional, closed loop)
→ [Stage 5] manifest.json → static site (Three.js STL viewer)
Some upstream providers behind the zen endpoint (notably Alibaba Model Studio,
which powers the qwen3.* models) run an input/output content-moderation
filter. When triggered, the call fails with an HTTP 400 whose body contains:
Input data may contain inappropriate content. For details, see: https://www.alibabacloud.com/help/en/model-studio/error-code#inappropriate-content
This can surface on either the code-gen call (a model's own output tripped the filter on a follow-up refinement turn) or the vision-review call (a snapshot was flagged). It is an upstream moderation decision, not a bug in cow-factory. The pipeline handles it gracefully:
- On code-gen: the exception is caught by the per-artifact task
(
asyncio.gather(..., return_exceptions=True)) and the artifact is recorded withstatus: "exception"andreview.status: "exception". It still appears on the site (with the error text in the errors panel) but produces no STL. - On vision review:
review.pycatches the error and writesreview.json: {"status": "vision_failed", "error": "..."}; the artifact's STL/snapshots are still shown, just without a review (and no round-2).
If a model trips the filter repeatedly, exclude it via --whitelist (or set
model_whitelist in config). See
https://www.alibabacloud.com/help/en/model-studio/error-code#inappropriate-content
for the upstream criteria.