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.

Normal map generated from the sample albedo texture

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

  1. 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.
  2. 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.
  3. 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.
  4. 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.

  1. 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.
  2. 02

    Add your key

    Export GENPBR_API_KEY in the shell that starts your agent. The skill reads it from there and never prints it.
  3. 03

    Ask for maps

    The agent checks quota, generates the maps you asked for, and saves them as PNGs next to your source image.
Install in any project
npx genpbr-skill

Adds .claude/skills/genpbr. Add --global to install it for every project.

Set the key
export GENPBR_API_KEY="gpbr_..."
Script the agent runs
# 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

Endpoint, authentication, limits and output facts for the texture API
FactValue
EndpointPOST https://genpbr.com/api/v1/generate-texture
AuthenticationX-API-Key: <key>, or Authorization: Bearer <key>
Required fieldsbaseImage (base64 or a data URL) and textureTypes (a non-empty array)
Map typesnormal, roughness, metallic, ao, height. Albedo is the input, not an output
Output formatPNG for every map, as data URLs in the JSON response
Body limit4 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 conventionOpenGL green by default (Roblox, Unity, Blender). Set options.invertNormalY to true for DirectX engines such as Unreal
Free tier25 requests a month per team, shared by all its keys. Any signed-in team that has never subscribed. No card
Free rate limit5 requests a minute per key
Quota windowCalendar month, counted from the 1st
Repeat requestsAn image and map type generated before do not use quota again
Health checkGET /api/v1/health-check, no key
Usage checkGET /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.

Optional generation settings, their fallback values and accepted ranges
OptionFallbackRange
normalStrength50.1 to 5
roughnessIntensity20.1 to 5
metallicIntensity0.80.1 to 5
aoIntensity20.1 to 5
aoRadius121 to 12
heightContrast10.1 to 3
heightBrightness0-0.5 to 0.5
heightInvertfalsetrue or false
invertNormalYfalsetrue 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.

Common API errors, what they mean, and the fix for each
SignalMeaningFix
401, "API key is required"No key reached the serverSend X-API-Key, or an Authorization Bearer header
401, "Monthly quota exceeded"The team has used its monthly quotaRead 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 MBResize the source image before you encode it
400, "Invalid texture types"A name in textureTypes is not on the listUse the names in the validTypes field of the response
400, "Invalid image data"baseImage is not valid base64Encode the file bytes as base64, or send a data URL with a complete payload
500, "Failed to generate textures"Generation failed on the serverRetry 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 countedSend 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.

Queue a job
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.