Skip to main content

Recraft image upscale and background-removal client for RunAPI

Project description

Recraft Python SDK for RunAPI

The Recraft Python SDK is the language-specific package for Recraft on RunAPI. Use it for image upscale and background-removal flows when your application needs JSON request bodies, task status lookup, and consistent RunAPI errors in Python.

For model details, use https://runapi.ai/models/recraft; for API reference, use https://runapi.ai/docs#recraft; for SDK docs, use https://runapi.ai/docs#sdk-recraft.

Install

pip install runapi-recraft

Quick start

from runapi.recraft import RecraftClient

client = RecraftClient()  # reads RUNAPI_API_KEY, or pass api_key="sk-..."

task = client.upscale_image.create(
    model="recraft-crisp-upscale",
    source_image_url="https://example.com/source.jpg",
)
status = client.upscale_image.get(task.id)

removed = client.remove_background.create(
    model="recraft-remove-background",
    source_image_url="https://example.com/source.jpg",
)

Use create to submit a task and return quickly, get to fetch the latest task state, and run to create and poll until completion:

result = client.upscale_image.run(
    model="recraft-crisp-upscale",
    source_image_url="https://example.com/source.jpg",
)
print(result.images[0].url)

In web request handlers, prefer create plus webhook or later get polling so a worker is not held open.

RunAPI-generated file URLs are temporary. Download and store generated images in your own durable storage within 7 days; do not treat returned URLs as long-term assets.

Language notes

Pass parameters as keyword arguments and catch the runapi.recraft error classes when building image jobs or scripts. The available resources are upscale_image and remove_background. Keep RUNAPI_API_KEY in the environment or your secret manager; never commit API keys or callback secrets.

Links

License

Licensed under the Apache License, Version 2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

runapi_recraft-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

runapi_recraft-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file runapi_recraft-0.1.0.tar.gz.

File metadata

  • Download URL: runapi_recraft-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for runapi_recraft-0.1.0.tar.gz
Algorithm Hash digest
SHA256 54488a9f274b8d0199747cd4c8144527241b4b2fd0fa75da599f88e4f6355521
MD5 a7fdf5aadfb35ac028e27368e0c3341c
BLAKE2b-256 139393176d80c99cbcc803cbbcb3460342307928cb4f5d1581a52436a29b642b

See more details on using hashes here.

File details

Details for the file runapi_recraft-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: runapi_recraft-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for runapi_recraft-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e61aceb143adec6df17bf55be16df559a41d8320def66197194e5c502b6a6524
MD5 bc607643a162a7b8117c0f8c2546c22d
BLAKE2b-256 989d296b10eab805845cf58497530a10ff1d2381d5611c8e0d7909dd032b7e19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page