# The Meshra API and Claude skill: let your own Claude design the part

Give your Claude Code the Meshra CAD skill: it writes the CadQuery, Meshra executes it in a sandbox and hands back STEP, STL, GLB files plus a slider editor.

---

Most of this blog is about talking to Meshra directly: opening the builder, typing a
sentence, watching a parametric part come together in the viewer. That is the whole
product for most people, and it works because Meshra's own chat handles the AI side end
to end.

But if you already live in Claude Code, there is a second way in. Meshra ships a public
API (`POST /api/v1/execute`) and a Claude Code skill that puts your own Claude in charge
of the design reasoning, while Meshra stays the geometry engine underneath. This post
covers what that actually means, how it is different from chatting in the builder, and
how to get it running.

## What the skill actually does

Install the Meshra skill and your Claude Code instance can write real parametric CAD
code on its own, in CadQuery, the same Python-based CAD language Meshra's builder
generates behind the scenes. Your Claude does the design thinking: it reads your
request, decides on a shape, and writes the code. Then it hands that code to Meshra,
which does the rest:

- Runs it in a sandboxed geometry kernel (the same OpenCascade-based engine behind the
  builder), not your local machine.
- Self-heals common geometry errors, the same recovery behavior the builder relies on,
  so a rough first draft of code still has a good shot at producing a valid solid.
- Hosts the result and hands back real files: STEP for CAD interchange or CNC, STL for
  slicing, and GLB for a quick 3D look, plus a link into a live browser editor where
  every dimension in the part is already a slider.

As the skill's own README puts it: "Your Claude does the design thinking. Meshra makes
it real." That split, reasoning on one side, geometry execution on the other, is the
whole idea.

## How this is different from the Meshra builder

In the builder, you type a prompt into Meshra's chat panel and Meshra's own model
(picked automatically based on your plan) writes the CadQuery for you, then executes
it. That is the fastest path for most people and it is why the builder exists.

The API and skill flip who writes the code. Your Claude Code session, running on your
own Anthropic account and your own tokens, does the design reasoning and produces the
CadQuery itself. Meshra never sees your prompt as a generation request; it only sees
already-written code to execute. That distinction matters for one concrete reason:
executing code is a deterministic run of an existing program, not a fresh AI
generation, so it does not draw from Meshra's own AI generation quota. It is free to
run on every plan, exactly the same way dragging a parameter slider on an existing part
is free: nothing is being generated from scratch, a program is just running.

This workflow is not for everyone, and it does not need to be. If you want the fastest
path from a sentence to a part, the builder is that path, and our post on [going from a
sentence to a printable part](/blog/from-a-sentence-to-a-printable-part) covers exactly
how that flow works. The skill is for a narrower audience: developers and makers who
already work inside Claude Code, want design iteration to happen in their own AI
session and history, and just need somewhere reliable to turn code into real,
manufacturable files without standing up a CAD kernel themselves.

<TryMeshra />

## Install it: the short version

Getting the skill running is a handful of steps, no build tooling required.

1. **Copy the skill folder into your Claude Code skills directory.** For every project:
   `cp -r claude-skill/meshra-cad ~/.claude/skills/meshra-cad`. For just one project:
   `cp -r claude-skill/meshra-cad .claude/skills/meshra-cad`.
2. **Get an API key.** Sign up at meshra.ai, open Settings, go to API Keys, and create
   one. Every key starts with the `mk_` prefix so you can recognize it at a glance.
3. **Export the key** so Claude Code can find it: `export MESHRA_API_KEY=mk_...`, or add
   that line to your shell profile so it persists across sessions.
4. **Ask Claude for a part**, in plain language, the same way you would describe it to
   a person.

That is the entire setup. There is no separate CLI to install and no local geometry
kernel to configure. The skill just teaches Claude Code how to write CadQuery and where
to send it.

One access note worth being upfront about: the public API sits behind Meshra's Pro
plan. An `mk_` key only works for an account on that tier, which keeps the sandboxed
execution capacity available for the developers actually using it. Free and Maker
accounts can still do everything else on Meshra, including all the deterministic,
no-AI-cost work like slider tweaks and starter templates; the API specifically is a
Pro-plan capability. Current plan details and what is included at each tier are on the
[pricing page](/pricing), which is the place to check before you build a workflow
around this, since we do not want to duplicate numbers here that could drift out of
date.

## A worked example

Here is a real prompt that exercises the whole path, straight from the skill's own
documentation:

> make me a wall bracket for a 30mm pipe, two M5 mounting holes

Ask Claude Code that, with the skill installed and `MESHRA_API_KEY` set, and here is
roughly what happens. Claude reasons about the request: a bracket needs a curved
cradle sized to a 30 mm pipe, a flat mounting face, and two holes sized for M5
hardware, which means a clearance diameter a shade over 5 mm, not exactly 5 mm, so the
screws actually pass through. It writes that logic out as CadQuery: a sketch for the
mounting plate, an extrude, a swept or revolved cradle profile fit to the pipe radius,
two bored holes at a sensible spacing, maybe a fillet where the cradle meets the plate
for strength.

That code goes to Meshra's API. The sandboxed kernel builds it. If Claude's first draft
has a small geometry issue, like a fillet radius that is too large for the surrounding
edges, the self-healing pass tries to correct it rather than failing outright. Once it
builds, you get back a completed result: a STEP file you could hand to a CNC shop, an
STL ready to slice, a GLB for a quick preview, and a builder link where the pipe
diameter, hole size, and plate thickness are already sliders. If the pipe you are
actually mounting to turns out to be 32 mm instead of 30, you do not go back to Claude
and ask for a new part. You open that editor link and drag the diameter slider, the
same instant, free re-execution the builder itself uses for every parameter change.

That last step is worth sitting with. The code Claude wrote is not a one-shot output
you either accept or throw away. It becomes a real parametric part in Meshra's system,
with the exact same slider-driven editing every part gets when it comes from the
builder's own chat. Our explainer on [parametric versus mesh
modeling](/blog/parametric-vs-mesh-modeling) covers why that matters: the reason you
can tune a hole size after the fact without a full regeneration is that the part is a
parametric program with named dimensions, not a frozen mesh, and that stays true no
matter which side of the API wrote the original code.

## Why this exists

Mesh-generating competitors do not have an equivalent to this because they do not have
an equivalent to Meshra's underlying representation. A mesh generator can hand you a
finished-looking shape, but there is no engineering program behind it for anything,
your Claude included, to reason about or extend. Meshra's parts are CadQuery programs
on top of a real geometry kernel, which means the "write the code yourself" door was
already there. The API and skill just open it, for the specific audience that wants
their own AI doing the design thinking while Meshra handles the part of the job that
actually needs a real CAD kernel: validating the geometry, healing it when it is close
but not quite right, and turning it into files a printer or a machine shop will accept.

If you build software for a living and already spend your day in Claude Code, this is
the fastest way to get a manufacturable part out of a conversation you were already
having. If you would rather skip the setup and just describe a part, the [template
gallery](/templates) and Meshra's own builder chat cover that exact case, no API key
required.
