Skip to content
Socaity Docs

Run Your First Model

Beginner
3 min

Install the SDK, install the model, generate an image, save it. Under 10 lines of Python.

Uses:flux_schnell — fast text-to-image, 4-step diffusion, ~1 second per image on a warm worker.

Step 1 — Install the SDK

The [all] extras pull in media-toolkit so result images get a built-in .save() helper, with image / audio / video format support.

terminal
pip install socaity[all]

Step 2 — Install the service

flux_schnell is not an official Socaity service, so you need to install it once. From then on it imports like any other module.

terminal
socaity --install flux_schnell

Step 3 — Generate an image

Import the service, call it with a prompt, and save the result. Calling the model returns a Job object — .get_result() blocks until the GPU finishes and returns a list of image objects with a .save() helper.

python
from socaity import flux_schnell

flux = flux_schnell()
images = flux(prompt="a lone astronaut on a neon planet, cinematic", num_outputs=1).get_result()

for img in images:
    img.save(f"{img}.png")

Step 4 — Get your API key (optional)

The SDK handles auth for you. If you ran socaity login once, a temporary key is cached — same flow as the gh or claude CLI. For production, prefer an environment variable.

terminal
# Option A — log in once, the SDK keeps a temp key (like gh or claude CLI)
socaity login

# Option B — export the key in your environment (good for production)
export SOCAITY_API_KEY="sk_..."

# Windows (PowerShell)
$env:SOCAITY_API_KEY = "sk_..."

What you built

  • Installed the socaity Python SDK with the [all] extras
  • Installed the flux_schnell service via socaity --install
  • Generated an image from a prompt and saved it to disk