# What AI Models Power Text-to-CAD? Inside the earthtojake/text-to-cad LLM Stack

> Discover the AI models powering text-to-CAD in the earthtojake/text-to-cad LLM stack. Learn about GPT-OSS-120B and Qwen 3 32B for efficient CAD generation.

- Repository: [earthtojake/text-to-cad](https://github.com/earthtojake/text-to-cad)
- Tags: internals
- Published: 2026-08-02

---

**Text-to-CAD relies on OpenRouter-hosted OpenAI GPT-OSS-120B as its primary large language model, with Qwen 3 32B configured as the secondary "small" model for cost-sensitive or latency-critical tasks.**

The earthtojake/text-to-cad open-source project transforms natural language descriptions into manufacturable 3D CAD files using a sophisticated LLM pipeline. Understanding exactly which AI models power text-to-CAD helps developers optimize inference costs and generation quality when building parametric geometries.

## Primary and Secondary AI Models

The repository defines two distinct LLM tiers in [[`opencode.json`](https://github.com/earthtojake/text-to-cad/blob/main/opencode.json)](https://github.com/earthtojake/text-to-cad/blob/main/opencode.json) to balance capability against computational expense.

### OpenAI GPT-OSS-120B (Primary)

The main intelligence layer is the **OpenAI GPT-OSS-120B** model, accessed via the OpenRouter endpoint `openrouter/openai/gpt-oss-120b`. This 120-billion-parameter model handles complex prompt interpretation and generates the OpenSCAD or Python code required for CAD generation.

### Qwen 3 32B (Small Model)

For lighter workloads or faster iteration cycles, the system falls back to **Qwen 3 32B** (`openrouter/qwen/qwen3-32b`). This 32-billion-parameter model from Alibaba's Qwen family provides lower latency and reduced token costs while maintaining sufficient capability for simpler geometric descriptions.

## Model Configuration in opencode.json

The definitive source for model selection resides in [`opencode.json`](https://github.com/earthtojake/text-to-cad/blob/main/opencode.json) at the repository root. This configuration file declares both LLMs under the `model` and `small_model` keys, respectively.

```json
{
  "model": "openrouter/openai/gpt-oss-120b",
  "small_model": "openrouter/qwen/qwen3-32b",
  "provider": "openrouter"
}

```

The **Instagit** runtime reads these entries during skill initialization, automatically injecting required headers including `OpenRouter-App-Title` and `OpenRouter-App-URL` into every API request.

## How the Instagit SDK Routes LLM Requests

When a text-to-CAD skill executes, it invokes the LLM through the **Instagit SDK**. The SDK abstracts OpenRouter's routing logic, handling provider selection and automatic fallbacks.

```python
from instagit.sdk import InstagitClient

client = InstagitClient()

# Primary model selection with fallback

response = client.llm.complete(
    prompt="Create a parametric bracket 30mm long",
    model="openrouter/openai/gpt-oss-120b",
    fallback="openrouter/qwen/qwen3-32b"
)

```

The `complete()` method automatically references the configuration in [`opencode.json`](https://github.com/earthtojake/text-to-cad/blob/main/opencode.json) to resolve credentials and endpoint URLs.

## From Prompt to CAD File: The Execution Pipeline

The AI models power text-to-CAD through a four-stage pipeline:

1. **Prompt Engineering** – Skills construct detailed prompts describing target geometry (e.g., "10mm diameter cylinder with 5mm height").
2. **LLM Generation** – The selected model returns executable code (Python or OpenSCAD syntax).
3. **CAD Translation** – The **`cadpy`** package (`packages/cadpy/src/cadpy/`) validates and compiles model output into standard formats (`.step`, `.stl`, `.glb`).
4. **Viewer Rendering** – Generated assets pass to the **CAD Viewer** (`viewer/`) for web-based inspection, as validated in [[`viewer/src/client/workbench/fileMetadata.test.js`](https://github.com/earthtojake/text-to-cad/blob/main/viewer/src/client/workbench/fileMetadata.test.js)](https://github.com/earthtojake/text-to-cad/blob/main/viewer/src/client/workbench/fileMetadata.test.js).

## CLI Usage: Selecting Models at Runtime

You can override the default GPT-OSS-120B model when invoking text-to-CAD from the command line.

### Using the Default Primary Model

```bash
npx skills install earthtojake/text-to-cad

text-to-cad cad generate \
  --prompt "Create a 20mm × 20mm × 20mm solid cube" \
  --output models/cube.step

```

This command routes to `openrouter/openai/gpt-oss-120b` and outputs a STEP file via `cadpy`.

### Switching to the Small Model

```bash
text-to-cad cad generate \
  --prompt "Generate a 5mm radius cylinder" \
  --model qwen3-32b \
  --output models/cylinder.stl

```

The `--model qwen3-32b` flag forces selection of the Qwen 3 32B endpoint, reducing latency for simple geometries. The CLI argument parsing logic is tested in [`viewer/src/server/serverArgs.test.mjs`](https://github.com/earthtojake/text-to-cad/blob/main/viewer/src/server/serverArgs.test.mjs).

## Programmatic Access with Python

For custom pipelines, interact directly with the Instagit SDK and `cadpy` generation API:

```python
from instagit.sdk import InstagitClient
from cadpy import generation

client = InstagitClient()

# Uses GPT-OSS-120B by default per opencode.json

response = client.llm.complete("Design a gear with 20 teeth")

# Convert LLM output to CAD

cad_file = generation.from_openscad(response.text, fmt="step")

with open("models/gear.step", "wb") as f:
    f.write(cad_file)

```

The `generation.from_openscad()` function in `packages/cadpy/src/cadpy/` handles the conversion from model-generated code to binary CAD formats.

## Summary

- **Text-to-CAD** uses **OpenAI GPT-OSS-120B** as its primary LLM via OpenRouter (`openrouter/openai/gpt-oss-120b`).
- A secondary **Qwen 3 32B** model provides faster, lower-cost inference for simpler tasks.
- Model selection is configured in [[`opencode.json`](https://github.com/earthtojake/text-to-cad/blob/main/opencode.json)](https://github.com/earthtojake/text-to-cad/blob/main/opencode.json) and managed by the **Instagit SDK**.
- The **`cadpy`** package processes LLM outputs into standard CAD formats (STEP, STL, GLB).
- Developers can override model selection via CLI flags or SDK parameters to balance quality against latency.

## Frequently Asked Questions

### Which specific AI model does text-to-CAD use by default?

The system defaults to **OpenAI GPT-OSS-120B**, a 120-billion-parameter model hosted on OpenRouter at the endpoint `openrouter/openai/gpt-oss-120b`. This configuration is hardcoded as the primary model in [`opencode.json`](https://github.com/earthtojake/text-to-cad/blob/main/opencode.json).

### Can I use a different LLM with text-to-CAD?

Yes. While the repository pre-configures GPT-OSS-120B and Qwen 3 32B, the Instagit SDK supports any OpenRouter-compatible model. You can specify alternatives using the `--model` CLI flag or by modifying the `model` field in [`opencode.json`](https://github.com/earthtojake/text-to-cad/blob/main/opencode.json), provided the alternative supports function calling and code generation.

### What is the difference between the primary and small models in text-to-CAD?

The **primary model** (GPT-OSS-120B) handles complex parametric designs and multi-step geometric reasoning. The **small model** (Qwen 3 32B) offers approximately 4x faster inference at lower cost, making it suitable for simple primitives like cubes, cylinders, and basic extrusions.

### How does text-to-CAD convert LLM text output into actual CAD files?

The **`cadpy`** Python package (`packages/cadpy/src/cadpy/`) parses the code generated by the LLM—typically OpenSCAD or Python syntax—validates the geometry, and compiles it into industry-standard formats like STEP or STL. The `generation.from_openscad()` function specifically handles OpenSCAD translation.