Home / Guides / Claude Code with Blender

How to use Claude Code with Blender for game assets

Short answer: Blender has a full Python API and runs without a window. So Claude Code can write a script that cleans up a model, then run it with blender --background --python to batch fix and export your assets. That is perfect for AI models from Meshy or Tripo, which often come out too heavy, off center and badly named. You check the result. A Blender MCP add-on is optional. Facts below come from Anthropic's, Blender's and each engine's official docs and the add-on's own GitHub page, checked Oct 26, 2026, and the script was tested on Blender 5.2.3 LTS.

New to AI 3D models? Start with Best free AI 3D model generators for game assets, then come back here to clean up what you generate.

First, the honest part: Claude Code is not free

Claude's pricing page marks Claude Code as not included in the Free plan. You need Pro ($20/mo billed monthly, or $17/mo on the annual plan at $200 up front), Max (from $100/mo), Team or Enterprise. Anthropic's quickstart also accepts a Claude Console account, which is pay as you go API credits. Checked Oct 26, 2026.

On a zero budget:

What you need

Claude

AI assistant that writes game code, explains bugs and builds playable prototypes.

Pricing: Freemium, from $20/mo. Beginner rating: 5/5. Explains code clearly to beginners.

Claude Code comes with Pro and higher plans. Not in the Free plan (checked Oct 26, 2026).

Setup, step by step

1. Install Blender and make it runnable from a terminal

Download Blender from blender.org/download. Claude Code runs Blender through the terminal, so it must be callable by name. Add the folder that holds the Blender program to your PATH (on macOS the program is inside the app at Blender.app/Contents/MacOS/Blender), or write the full path into CLAUDE.md. Then check it:

blender --version

It should print the version, like Blender 5.2.3 LTS.

2. Install Claude Code and open your asset folder

On macOS, Linux or WSL, Anthropic's quickstart gives this install command (Windows has its own PowerShell and CMD commands on the same page):

curl -fsSL https://claude.ai/install.sh | bash

Make a folder with raw/ for downloaded models, scripts/ for Python files and export/ for results. Open a terminal there and run claude. It asks you to log in the first time.

3. Add a CLAUDE.md

Claude Code reads CLAUDE.md at the start of every session (see Anthropic's memory docs). Keep it short and concrete. Edit the engine and triangle budget for your game:

# Blender asset notes for Claude

- Blender 5.2.3 LTS. Binary: blender (on PATH).
- Use the Blender 5 Python API (bpy). Old 2.x and 3.x code may not
  work: OBJ import is bpy.ops.wm.obj_import, not import_scene.obj.
- Layout: raw/ has downloaded models (never edit or delete these),
  scripts/ has .py files, export/ gets the cleaned GLB and FBX files.
- Target engine: Godot 4 (GLB). Props: under 5,000 triangles.
- Units: 1 Blender unit = 1 meter. Origin at the bottom center.
- Names: lowercase_with_underscores, matching the file name.

## Run scripts like this
blender --background --python-exit-code 1 --python scripts/FILE.py -- ARGS
Without --python-exit-code 1, Blender exits 0 even when the script
crashes. Read the output and report the triangle count before and after.

## Ask first
- Before deleting files, overwriting anything in export/,
  or editing files in raw/.

The cleanup script

This is the kind of script to ask Claude for. It takes one model and does what most AI props need before they go in a game:

Save it as scripts/clean_export.py:

# Clean up one static prop and export it for game engines.
# Run: blender --background --python clean_export.py -- IN_FILE OUT_DIR NAME RATIO
# Example: blender --background --python clean_export.py -- raw/chest.glb export chest 0.5
import sys, os, bpy, bmesh

args = sys.argv[sys.argv.index("--") + 1:]
src, out_dir, name, ratio = args[0], args[1], args[2], float(args[3])
os.makedirs(out_dir, exist_ok=True)

# Start from an empty scene so nothing from the default file leaks in.
bpy.ops.wm.read_factory_settings(use_empty=True)
ext = os.path.splitext(src)[1].lower()
if ext in (".glb", ".gltf"):
    bpy.ops.import_scene.gltf(filepath=src)
elif ext == ".fbx":
    bpy.ops.import_scene.fbx(filepath=src)
elif ext == ".obj":
    bpy.ops.wm.obj_import(filepath=src)
else:
    sys.exit(f"Unsupported file type: {ext}")

meshes = [o for o in bpy.context.scene.objects if o.type == "MESH"]
if not meshes:
    sys.exit("No mesh objects found")

def tris():
    return sum(len(p.vertices) - 2 for o in meshes for p in o.data.polygons)

print(f"Imported {len(meshes)} meshes, {tris()} triangles")

# Clear parents (keeps world position), then apply rotation and scale.
bpy.ops.object.select_all(action="DESELECT")
for o in meshes:
    o.select_set(True)
bpy.context.view_layer.objects.active = meshes[0]
bpy.ops.object.parent_clear(type="CLEAR_KEEP_TRANSFORM")
bpy.ops.object.transform_apply(location=False, rotation=True, scale=True)

# Merge duplicate vertices and decimate each mesh.
for o in meshes:
    bm = bmesh.new()
    bm.from_mesh(o.data)
    bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.0001)
    bm.to_mesh(o.data)
    bm.free()
    if ratio < 1.0:
        mod = o.modifiers.new("Decimate", "DECIMATE")
        mod.ratio = ratio
        bpy.context.view_layer.objects.active = o
        bpy.ops.object.modifier_apply(modifier=mod.name)

# Join into one object and give it a clean name.
bpy.context.view_layer.objects.active = meshes[0]
if len(meshes) > 1:
    bpy.ops.object.join()
obj = bpy.context.view_layer.objects.active
obj.name = name
obj.data.name = name
meshes = [obj]

# Origin at the bottom center, object at the world origin.
corners = [obj.matrix_world @ v.co for v in obj.data.vertices]
xs, ys, zs = zip(*corners)
bpy.context.scene.cursor.location = ((min(xs) + max(xs)) / 2, (min(ys) + max(ys)) / 2, min(zs))
bpy.ops.object.origin_set(type="ORIGIN_CURSOR")
obj.location = (0, 0, 0)

print(f"Cleaned {name}: {tris()} triangles, size {tuple(round(d, 3) for d in obj.dimensions)}")

# Export only this object.
bpy.ops.object.select_all(action="DESELECT")
obj.select_set(True)
bpy.ops.export_scene.gltf(filepath=os.path.join(out_dir, name + ".glb"),
                          export_format="GLB", use_selection=True)
bpy.ops.export_scene.fbx(filepath=os.path.join(out_dir, name + ".fbx"),
                         use_selection=True, object_types={"MESH"})
print("Exported", name + ".glb and", name + ".fbx")

Run it like this. Everything after -- goes to the script, not to Blender:

blender --background --python-exit-code 1 --python scripts/clean_export.py -- raw/chest.glb export chest 0.5

What we tested (Oct 26, 2026, Blender 5.2.3 LTS on Linux): we fed it a two part GLB with 16,140 triangles, an off center position, rotation and scale, and junk names. It printed Cleaned chest: 8070 triangles and wrote chest.glb and chest.fbx. Re-importing both showed one object named chest, at the world origin, with its lowest point at exactly 0. The GLB passed the Khronos glTF Validator with 0 errors and 0 warnings. We also ran it on a textured FBX and an OBJ, and the GLB kept its image texture.

Watch out: when the input file did not exist, plain blender --background --python printed a Python traceback and still exited with code 0. Adding --python-exit-code 1 (from Blender's command line arguments page) made it exit 1. That is why the CLAUDE.md above tells Claude to always use it.

Prompts that work

Ask for one change at a time, run it, look at the result, commit, repeat.

Which format for which engine

EngineUseWhy
GodotGLBGodot's 3D formats docs call glTF 2.0 the recommended format. FBX also imports (through ufbx since Godot 4.3).
UnityFBXUnity's manual says FBX is its internal import format and best practice. For GLB, add Unity's glTFast package.
UnrealFBX or GLBUnreal imports both through its Interchange framework. See Epic's glTF docs.
three.jsGLBLoad it with three.js's GLTFLoader.

Want the full engine side? Read How to use Claude Code with Godot, How to use Claude Code with Unity, How to use Claude Code with Unreal Engine or How to make a browser game with three.js and AI.

Cleaning up AI models from Meshy and Tripo

Generated models usually look fine in a preview but cause trouble in a game. Typical fixes, all covered by the script or a small change to it:

License check before you ship: Meshy's pricing page says Free plan models are licensed CC BY 4.0, which allows commercial use with credit to Meshy. Tripo's pricing page labels Free plan models as public and for non-commercial use, with commercial use on paid plans. Both checked Oct 26, 2026. Cleaning a model up in Blender does not change its license. More in Meshy vs Tripo for 3D game assets and Can I sell a game made with AI art?.

Meshy

Turns text or images into textured 3D models ready for game engines.

Pricing: Freemium, from $20/mo. Beginner rating: 5/5. Very easy text or image to 3D workflow.

Free plan: 100 credits a month, CC BY 4.0 license (commercial use with credit). Downloads GLB, FBX, OBJ and .blend, among others.

Tripo

Generates 3D models from text or images, with auto rigging options.

Pricing: Freemium, from $20/mo. Beginner rating: 5/5. Quick results and beginner friendly UI.

Free plan: 200 credits a month, public and non-commercial models only.

Characters are different. This script is for static props. It joins meshes and exports meshes only, so it would drop a skeleton. For a character that walks and jumps, rig it with Mixamo and follow How to animate a 3D character for free or Mixamo vs Cascadeur for game animation.

Optional: the BlenderMCP add-on

MCP (Model Context Protocol) is a standard way to give an agent extra tools. You do not need it for the script workflow above. MCP for Blender (formerly blender-mcp, by ahujasid) is a community project, MIT licensed. Its README says it is a third-party integration not made by Blender, and it is not made by Anthropic. It lets Claude see and change a Blender window you have open: create and edit objects and materials, take viewport screenshots, and run Python in your live scene.

Per its README (checked Oct 26, 2026; the latest PyPI release was 2.2.4 from Oct 24, 2026), you need Blender 3.0 or newer, Python 3.10 or newer and the uv package manager. The manual setup for Claude Code is:

claude mcp add blender uvx mcp-for-blender
uvx mcp-for-blender install-addon

Then in Blender open Edit, Preferences, Add-ons and enable Interface: MCP for Blender. Press N in the 3D viewport, open the MCP for Blender tab, and click Start MCP Server if it is not running. The README also offers a one command setup (uvx mcp-for-blender setup) that finds your AI apps and installs the add-on for you.

We did not install or test the add-on for this guide.

Common pitfalls

Sources (checked Oct 26, 2026)

Related

Picking a generator? Read Best free AI 3D model generators for game assets or Meshy vs Tripo for 3D game assets. Animating a character? See How to animate a 3D character for free. Not sure which agent to pay for? Read Claude Code vs Codex vs Cursor for game dev.

Browse every 3D model and texture tool, every coding and game logic tool, or grab ready made models from the free asset libraries.

FAQ

Is Claude Code free?

No. Claude's pricing page lists Claude Code as not included in the Free plan. It is included in Pro ($20/mo billed monthly, or $17/mo with the annual plan at $200 up front) and higher plans, or you can pay per use with a Claude Console (API) account. Checked on claude.com/pricing on Oct 26, 2026. Blender is free.

Which Blender version should I use?

The current stable release. Blender's download page listed Blender 5.2.3 LTS, released Oct 22, 2026, when we checked on Oct 26, 2026, and that is the version we tested the script in this guide with. Put your exact version in CLAUDE.md, because Blender's Python API changes between major versions.

Do I need BlenderMCP to use Claude Code with Blender?

No. Claude Code can write a Python script and run Blender headless with blender --background --python, which needs nothing extra. The community MCP for Blender add-on (formerly blender-mcp) is optional and lets Claude control a Blender window you have open.

Is BlenderMCP made by Blender?

No. Its README calls it a third-party integration not made by Blender, and it is not made by Anthropic either. The code is MIT licensed on GitHub. It also offers an optional paid Premium tier, which we did not check.

Will this fix any AI-generated model?

No. A script can cut triangles, merge duplicate vertices, apply transforms, set the origin, rename and export. It cannot fix a bad shape, broken UVs or a messy texture. Always look at the result in Blender or your engine before you use it.

Can I use this script on a rigged character?

Not as written. It joins all meshes and exports meshes only, so it would drop the skeleton. Use it for static props. For characters, follow How to animate a 3D character for free, which covers Mixamo and getting a rigged GLB into your engine.

Get the free First Game Starter Pack

A 7-step path to your first tiny game, free art and sound you can actually use, and our AI tools kit for Godot, Unity, Unreal and Roblox. Plus one short tool tip a week. No spam, unsubscribe any time.

No spam. Unsubscribe in 1 click. Privacy See past issues

Preview of the First Game Starter Pack: the README, the AI Tools Kit and the first game checklist