For AI agents
Texture generation API for AI agents
One POST request turns a base image into the PBR maps a game engine imports. Use it from a script, a CI job, or a coding agent.

GenPBR's API turns one base image into normal, roughness, metallic, ambient occlusion, and height maps. Send the image as base64 in a POST to /api/v1/generate-texture with an X-API-Key header. Each map returns as a PNG data URL in the JSON response. A free key covers 25 requests a month, no card needed.
Free key · no card · 25 requests a month · 5 a minute
Four steps from an agent to a map file
- 01
Check that the API is up
GET /api/v1/health-check needs no key. A healthy service returns HTTP 200 and status "healthy". A 503 means the service is degraded or down, so wait and retry instead of sending the image. - 02
Store one key in the environment
Create a key at /dashboard/api-keys (up to 5 keys per team) and save it as GENPBR_API_KEY. Keep it out of source files and prompts. - 03
Send the image and the map list
POST the base image to /api/v1/generate-texture. Set textureTypes to the maps you need from normal, roughness, metallic, ao, and height. Send the key as the X-API-Key header or as a Bearer token. - 04
Decode each map and read the quota
Each value in textures is a data:image/png;base64 string. Strip the prefix, decode the base64, and write the PNG. Read usage.remainingQuota from the same response, or call GET /api/v1/usage-stats.
The full request and response are in the API reference.
Install the coding-agent skill
For Claude Code and other coding agents. The skill carries the workflow, so you do not paste API docs into the prompt.
- 01
Install the skill
Run it in the project you want to generate maps for. It writes a skill folder that agents load on demand. - 02
Add your key
ExportGENPBR_API_KEYin the shell that starts your agent. The skill reads it from there and never prints it. - 03
Ask for maps
The agent checks quota, generates the maps you asked for, and saves them as PNGs next to your source image.
npx genpbr-skillAdds .claude/skills/genpbr. Add --global to install it for every project.
export GENPBR_API_KEY="gpbr_..."# Check quota before a batch
node .claude/skills/genpbr/scripts/genpbr.mjs usage
# Normal and roughness from a local file
node .claude/skills/genpbr/scripts/genpbr.mjs generate albedo.png --types normal,roughness --out textures/Facts an agent can plan around
| Fact | Value |
|---|---|
| Endpoint | POST https://genpbr.com/api/v1/generate-texture |
| Authentication | X-API-Key: <key>, or Authorization: Bearer <key> |
| Required fields | baseImage (base64 or a data URL) and textureTypes (a non-empty array) |
| Map types | normal, roughness, metallic, ao, height. Albedo is the input, not an output |
| Output format | PNG for every map, as data URLs in the JSON response |
| Body limit | 4 MB on this route. Larger bodies return 413. Base64 adds about a third to file size, so keep the source image near 3 MB or less |
| Normal map convention | OpenGL green by default (Roblox, Unity, Blender). Set options.invertNormalY to true for DirectX engines such as Unreal |
| Free tier | 25 requests a month per team, shared by all its keys. Any signed-in team that has never subscribed. No card |
| Free rate limit | 5 requests a minute per key |
| Quota window | Calendar month, counted from the 1st |
| Repeat requests | An image and map type generated before do not use quota again |
| Health check | GET /api/v1/health-check, no key |
| Usage check | GET /api/v1/usage-stats, with the key |
Options
Put these under "options" in the body. A value you send is clamped to its range. An omitted value uses the fallback.
| Option | Fallback | Range |
|---|---|---|
normalStrength | 5 | 0.1 to 5 |
roughnessIntensity | 2 | 0.1 to 5 |
metallicIntensity | 0.8 | 0.1 to 5 |
aoIntensity | 2 | 0.1 to 5 |
aoRadius | 12 | 1 to 12 |
heightContrast | 1 | 0.1 to 3 |
heightBrightness | 0 | -0.5 to 0.5 |
heightInvert | false | true or false |
invertNormalY | false | true or false (true gives DirectX green) |
Errors an agent can branch on
Match on the status and the message. Then take the fix from the same row.
| Signal | Meaning | Fix |
|---|---|---|
401, "API key is required" | No key reached the server | Send X-API-Key, or an Authorization Bearer header |
401, "Monthly quota exceeded" | The team has used its monthly quota | Read usage-stats. Free teams wait for the next calendar month, or move to a paid plan at /pricing |
429, "Rate limit exceeded" | The key sent more requests than its minute allowance (5 on the free tier) | Wait 60 seconds, then send the same request again |
413, "Request body too large" | The base64 body is over 4 MB | Resize the source image before you encode it |
400, "Invalid texture types" | A name in textureTypes is not on the list | Use the names in the validTypes field of the response |
400, "Invalid image data" | baseImage is not valid base64 | Encode the file bytes as base64, or send a data URL with a complete payload |
500, "Failed to generate textures" | Generation failed on the server | Retry once. If it fails again, report the request size and the response on /support |
402, "Insufficient quota" | The request needs one use per map, and the team has fewer uses left. Nothing is generated and nothing is counted | Send fewer texture types, or split the batch across months. A repeat of an earlier request is free and skips this check |
Every code, with its retry rule, is in the error reference.
Long batches
For work that should not block the agent, POST /api/v1/generate-texture-async queues a job and returns a job id straight away. Poll GET /api/v1/jobs/{id} for the result, or pass a webhook URL to be notified when the job finishes.
Async, batch and upscale routes are gated by plan. On the free tier they return plan_not_eligible. Starter, Pro and Lifetime Founder plans include them.
curl -sS -X POST https://genpbr.com/api/v1/generate-texture-async \
-H "X-API-Key: $GENPBR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"baseImage":"<base64 PNG>","textureTypes":["normal","roughness"]}'Machine-readable resources
The same steps work without this page. Ask for this page with Accept: text/markdown to get the same copy as plain text.
- OpenAPI schemaThe full API, including the auth scheme.
- Onboarding manifestFree tier, self-serve keys, and the sandbox flags.
- Site summaryA short map of the site for agents.
- Coding agent skillnpx genpbr-skill teaches Claude Code and other coding agents to call the API.
When not to use the API
Use the API when a script, a CI job, or an agent runs the same steps on many images.
The browser tool at /generate needs no key and no code. It suits one image at a time, with a person adjusting the settings. The API does not generate textures from a text prompt, make 3D meshes, or write Substance Designer graphs. For those jobs, the comparison page at /compare lists the other tools.
Questions agents and their people ask
- Can an AI agent generate PBR maps without a person in the loop?
- After a person creates a key, yes. The agent reads the key from GENPBR_API_KEY and calls POST /api/v1/generate-texture. Keys are made in the dashboard, not by the API, so the first key always needs a signed-in account.
- Does the free API tier need a credit card?
- No. Any signed-in team that has never subscribed gets 25 requests a month, shared by all its keys, with a limit of 5 requests a minute per key. Paid plans raise both numbers.
- Which file format do the maps come back in?
- PNG. Each map you asked for is a separate data URL in the textures object. The metadata reports the width and height of the output.
- Can an agent check the API without using quota?
- Yes. GET /api/v1/health-check needs no key and reports the service status. GET /api/v1/usage-stats uses your key and returns the month to date. Neither call generates a texture.
- Does the API return the albedo or the source image?
- No. Albedo is the input. The API returns normal, roughness, metallic, ao, and height maps.
Make the first call
A free key needs a signed-in account and no card. Your first request uses one of the 25 monthly requests.