Skip to content

About

OpenSCAD 3D model generation & refinement pipeline with a silly website for comparing open-weight LLMs.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

cow-factory

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.

Screenshot_20260705_232256 Screenshot_20260705_232408

Setup

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 key

Requires openscad on PATH (headless). No other system packages.

Usage

# 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 1

Output 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.

Pipeline

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)

Troubleshooting

Input data may contain inappropriate content

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 with status: "exception" and review.status: "exception". It still appears on the site (with the error text in the errors panel) but produces no STL.
  • On vision review: review.py catches the error and writes review.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.

About

OpenSCAD 3D model generation & refinement pipeline with a silly website for comparing open-weight LLMs.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages