afk.ai Auto-Rig

v1.3.6
io.github.dyoburon/afk-rig Checked 49 minutes ago Published 21 days ago

Auto-rig 3D models (GLB, glTF, FBX) with skeleton, skin weights and 170+ animations via afk.ai.

Auto-rig 3D models with the afk.ai API: upload a GLB, glTF or FBX, get back a rigged GLB with a skeleton, skin weights and every animation for its body type. The same AI rig as afk.ai/rig, from your terminal, your code or your AI agent. Or start from a picture: one call makes the 3D model from it and rigs it with every animation. Make a key on the API dashboard at afk.ai/developers/dashboard (sign in with Google, then Create key). It's shown once, so copy it somewhere safe, and keep it out of web pages and apps people download.

Summary extracted from the README.

afk-rig

Auto-rig 3D models with the afk.ai API: upload a GLB, glTF or FBX, get back a rigged GLB with a skeleton, skin weights and every animation for its body type. The same AI rig as afk.ai/rig, from your terminal, your code or your AI agent. Or start from a picture: one call makes the 3D model from it and rigs it with every animation.

export AFK_API_KEY=afk_...            # from https://afk.ai/developers/dashboard
npx afk-rig knight.glb --type human -o knight.rigged.glb
npx afk-rig character knight.png -o knight.glb      # a picture in, a rigged, animated character out

API key and pricing

Make a key on the API dashboard at afk.ai/developers/dashboard (sign in with Google, then Create key). It's shown once, so copy it somewhere safe, and keep it out of web pages and apps people download.

  • Free: your first 3 cloud rigs each month. This is the same allowance as on afk.ai/rig, not a separate one.
  • With afk.ai Lifetime: $10 of API credit for rigs every month (200 rigs), used after the free rigs and before your credits. It starts again on the 1st and doesn't cover characters.
  • After that: 5¢ a rig from API credits, which you add on the account page ($10, $25 or $100). Credits never expire.
  • One rig is the rigged model with every animation for its body type (594 for humans today; afk-rig types human lists them).
  • Re-rigs are free: rigging the same model again in the same month (another body type, another facing, or a retry) is free for 3 more rigs.
  • Failed rigs cost nothing: the price is held when a rig starts and only charged once the file is ready. That includes a model our content check turns down.
  • A character from a picture is 25¢ per character from your credits: the 3D model, the rig and every animation; refunded if it fails. Free rigs don't cover characters. The CLI prints what it charged and the credits you have left (--json adds credits_left_usd), and the MCP tool returns both.

CLI

afk-rig <model> [options]          rig a model and write the rigged .glb
afk-rig character <image> [options]
                                   make a rigged, animated character from a picture
afk-rig status <rig id>            a rig's status
afk-rig download <rig id> -o <file>
afk-rig account                    free rigs left this month, Lifetime credit and API credits
afk-rig types [type]               body types, and a type's animations
afk-rig mcp                        run as an MCP server on stdio

  -t, --type <type>        human (default), fox, horse, bird, dragon, kaiju, spider, insect, snake,
                           fish, kangaroo, frog, turtle, ghost, object
  -a, --animations <list>  all (default), none, or names separated by commas
      --facing <degrees>   auto (default), 0, 90, 180 or 270
      --keep-arms-out 0    a human's animations as they come (see below)
  -o, --out <file>         default: <model or image>.rigged.glb next to it
      --no-wait            start the rig and print its id
      --json               print JSON

Progress goes to stderr and the path of the file written to stdout. The exit code is 0 on success, 3 when you're out of free rigs and credits, and 1 for anything else. When you already have 2 rigs running, the CLI waits for one to finish.

Type For
human people, robots, anything on two legs
fox dogs, cats, foxes, wolves
horse horses, deer, cows
bird wings, two legs
dragon wings and four legs
kaiju dinosaurs and upright monsters with tails
spider spiders and insects without wings
insect flying insects: wasps, bees, dragonflies
snake no legs
fish fish, sharks, whales
turtle turtles and tortoises
kangaroo, frog, ghost, object what they say

In your AI agent (MCP)

claude mcp add afk-rig --env AFK_API_KEY=afk_... -- npx -y afk-rig mcp

Cursor and other clients (mcp.json):

{
  "mcpServers": {
    "afk-rig": { "command": "npx", "args": ["-y", "afk-rig", "mcp"], "env": { "AFK_API_KEY": "afk_..." } }
  }
}

Tools: rig_model (rigs a file and writes the .glb), image_to_character (makes a rigged character from a picture and writes the .glb), get_account, list_body_types and rig_status.

Fixing a rigged model, on your computer (these need no key and cost nothing): inspect_rig (bones, meshes, the animations with problems, worst first, each with the moment to look at — sinking into the floor, never touching it, skin tearing, a forearm or hand through the body — and the controls; flying and swimming animations are marked as in the air rather than judged against the floor), render_rig (an image of it at rest or posed at any moment of an animation, with its skeleton), adjust_animation (afk.ai/rig's animation controls: turn parts of the body, speed, bounce, sway, move a hand or foot, keep the arms out of the body), fix_stretching and fix_spot (afk.ai/rig's Fix stretching and Fix a spot). Each edit writes a new file (knight-v2.glb, then -v3…) and reports the numbers before and after, so an agent can look, change one thing, and check.

Fixing a rigged model

The same tools on the command line. They run on your computer with afk.ai/rig's own Adjust code: no API key, nothing charged, nothing uploaded. An edit never changes the file it reads.

npx afk-rig inspect knight.glb                     # what's wrong, per animation, and the controls you can use
npx afk-rig render knight.glb --animation Walk --time 0.4 -o walk.png   # pinkish red: the inside of the mesh showing
npx afk-rig adjust knight.glb --set armsUp=15 --keep-arms-out 1 -a Walk,Idle_A   # writes knight-v2.glb
npx afk-rig adjust knight.glb -a Jump_Start --move foot_r=0,0.1,0 --space root --range foot_r=0.1,0.3,0.05   # one moment only
npx afk-rig fix-stretching knight.glb
npx afk-rig fix-spot knight.glb --where '{"near":"head","radius":0.12}' --fix follow --bone head

JavaScript

import { AfkRig } from 'afk-rig'

const afk = new AfkRig() // reads AFK_API_KEY
const { job } = await afk.rig('knight.glb', { type: 'human', output: 'knight.rigged.glb' })
console.log(job.billing) // { charge: 'free' | 'rerig' | 'lifetime' | 'credits', amount_usd: '0.05', state: 'charged' }

const made = await afk.character('knight.png', { type: 'human', output: 'knight.glb' })
console.log(made.job.billing) // { charge: 'character', amount_usd: '0.25', state: 'charged' }

The CLI and the MCP tools keep a human's arms out of its body in every animation once the rig is downloaded (below); afk.rig and afk.character give you the file as the API made it.

startRig (or startCharacter), getRig, waitForRig and downloadRig do the steps one at a time, and account() and types() return what the CLI prints. Errors are AfkRigErrors with the API's status and code (missing_api_key, invalid_api_key, insufficient_credits, rate_limited, unreadable_model, unriggable, content_not_allowed...).

Good to know

  • Arms out of the body: a human's rig from the CLI or the MCP tools comes with the arms turned out of the body wherever an animation puts a hand or forearm through it, as afk.ai/rig does. It runs on your computer after the download, on all its cores (about 20 s for all 594 of a humanoid's on an M-series Mac), costs nothing, and its numbers are in the output (keep_arms_out in --json and the MCP result). --keep-arms-out 0 (or keep_arms_out: false) leaves the animations as they come; afk-rig adjust <file> --keep-arms-out 1 does it later, to any of them.

  • Input: GLB, glTF with its buffers and textures embedded, or FBX. Draco- or meshopt-compressed meshes aren't supported yet, so export without mesh compression.

  • Model files can be up to 200 MB, textures included, with up to about 5 million vertices. Up to 2 rigs run at once per account, 100 can start per hour, and a finished rig can be downloaded for 24 hours.

  • Already-rigged models are rigged again in the pose they're shown in, and their old skeleton and animations are replaced.

  • The output is the same file a download from afk.ai/rig gives. Textures and materials come through as they were.

  • Pictures for characters: PNG, JPEG or WebP, up to 20 MB, of one character, whole, on a plain background, works best. A character is a textured model (PBR: colour, metal and roughness) rigged with every animation; it takes about 2 to 3 minutes (up to about 5 when our GPU has to start up) and counts toward the same limits as rigs.

  • Your model is uploaded to afk.ai's servers to be rigged. Like every rig on afk.ai, it goes through an adult-content check first; a model the check turns down fails with content_not_allowed and costs nothing.

Version 1 replaces the local rigger of afk-rig 0.x with the afk.ai API. Skeletons and animations are CC0, so you can use rigged models in anything, commercial included. Questions or bugs: support@afk.ai.