curl https://external.api.recraft.ai/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RECRAFT_API_TOKEN" \
-d '{
"prompt": "two race cars on a track",
"style": "digital_illustration",
"model": "recraftv3"
}'
curl https://external.api.recraft.ai/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RECRAFT_API_TOKEN" \
-d '{
"prompt": "a monster with lots of hands",
"style": "digital_illustration",
"substyle": "hand_drawn"
}'
curl -X POST https://external.api.recraft.ai/v1/images/imageToImage \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer $RECRAFT_API_TOKEN" \
-F "image=@image.png" \
-F "prompt=winter" \
-F "strength=0.2" \
-F "style=digital_illustration"
curl -X POST https://external.api.recraft.ai/v1/images/inpaint \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer $RECRAFT_API_TOKEN" \
-F "prompt=moon" \
-F "style=digital_illustration" \
-F "image=@image.png" -F "mask=@mask.png"
from openai import OpenAI
client = OpenAI(base_url='https://external.api.recraft.ai/v1', api_key=_RECRAFT_API_TOKEN)
response = client.post(
path='/images/inpaint',
cast_to=object,
options={'headers': {'Content-Type': 'multipart/form-data'}},
files={
'image': open('image.png', 'rb'),
'mask': open('mask.png', 'rb'),
},
body={
'style': 'digital_illustration',
'prompt': 'moon',
},
)
print(response['data'][0]['url'])
curl -X POST https://external.api.recraft.ai/v1/styles \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer $RECRAFT_API_TOKEN" \
-F "style=digital_illustration" \
-F "file=@image.png"
# response: {"id":"095b9f9d-f06f-4b4e-9bb2-d4f823203427"}
curl https://external.api.recraft.ai/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $RECRAFT_API_TOKEN" \
-d '{
"prompt": "wood potato masher",
"style_id": "095b9f9d-f06f-4b4e-9bb2-d4f823203427"
}'
curl -X POST https://external.api.recraft.ai/v1/images/vectorize \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer $RECRAFT_API_TOKEN" \
-F "file=@image.png"
curl -X POST https://external.api.recraft.ai/v1/images/removeBackground \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer $RECRAFT_API_TOKEN" \
-F "response_format=b64_json" \
-F "file=@image.png"
curl -X POST https://external.api.recraft.ai/v1/images/crispUpscale \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer $RECRAFT_API_TOKEN" \
-F "response_format=b64_json" \
-F "file=@image.png"
curl -X POST https://external.api.recraft.ai/v1/images/creativeUpscale \
-H "Content-Type: multipart/form-data" \
-H "Authorization: Bearer $RECRAFT_API_TOKEN" \
-F "file=@image.png"