Skip to main content
The Recraft API is a plain REST API. Any HTTP client works. The examples in these docs use curl, Python requests, and JavaScript fetch, and most Python examples also have a Python (OpenAI SDK) tab.

Any HTTP client

Send JSON (or multipart/form-data for file uploads) to https://external.api.recraft.ai/v1 with a Bearer token:
See Image inputs and results for how to send images and choose the response format.

OpenAI Python library

The OpenAI Python library is compatible with the Recraft API. Point it at the Recraft base URL:
Keep in mind:
  • Recraft-specific parameters go in extra_body. The library passes prompt, model, n, size, and response_format natively. Everything else (style_id, style_reference_urls, style_match, controls, image_format, negative_prompt, text_layout, …) must go through extra_body, or the library rejects it:
  • Endpoints outside the OpenAI API (styles, vectorize, upscale, inpaint, and others) are called with client.post:
  • multipart responses are not supported. The library reads JSON only, so use response_format url or b64_json with it, and a plain HTTP client for multipart.
  • Some OpenAI parameters don’t apply. Parameters without a Recraft meaning are ignored or may be interpreted differently. Check the model page for what each model accepts.

Other languages

Use your language’s standard HTTP client with the requests shown on each model page, or generate a client from the OpenAPI specification. The specification can lag behind these docs, so check new models and fields against the model pages.