1
Get an API token
Log in to Recraft, open your profile page, and select Generate. Generating a token needs a positive API units balance; buy units first if you have none. You can create several tokens, and they all share one balance.
2
Save it as an environment variable
RECRAFT_API_TOKEN.3
Make a request
model, the request uses Recraft V4.1 at $0.035 per image.4
Get the image
The response lists the generated images:Download the file from
data[0].url: image URLs are temporary and files are kept for about 24 hours. credits is the number of API units the request cost.Authentication
All requests authenticate with a Bearer token in theAuthorization header:
https://external.api.recraft.ai/v1. The API follows REST principles, so any HTTP client works. To use the OpenAI Python library instead, see Clients and SDKs.
Next steps
Choose a model
Compare every model by price, output, and best use case.
Fast generation
About 1.3 seconds and $0.007 per image with V4.1 Flash.
Vector output
Get editable SVG with a
_vector model.Generate in a style
Match a style from your own reference images.
Edit images
Image to image, inpainting, vectorizing, upscaling, and more.
Use with AI tools
Give Claude, ChatGPT, or Cursor the docs to write your integration.
All operations
The API also covers:- Create style, reusable custom styles from reference images.
- Image to image, inpainting, and outpainting.
- Replace background, generate background, and remove background.
- Vectorize image, crisp upscale, and creative upscale.
- Enhance details, erase region, and remix image.
- Enhance prompt and get user information.