Quickstart
This guide gets you from zero to a generated image in under 5 minutes. You'll need a Sogni AI account and API key.
Step 1 — Create an account and get your API key
Sign up at sognix.com/login/signup. After creating your account, navigate to Settings → API Keys and create a new key. Keep it secure — it's shown only once.
Step 2 — Install the SDK
The Python SDK is the easiest starting point. It requires Python 3.8+.
Terminal
$ pip install sogni-sdk
Successfully installed sogni-sdk-0.9.2
For Node.js: npm install sogni-sdk
Step 3 — Initialize the client
Python
from sogni import SogniClient
# Replace with your actual API key
client = SogniClient(api_key="sgn_your_key_here")
# Verify connectivity
print(client.models.list())
Step 4 — Generate your first image
Python
result = client.images.generate(
model="stable-diffusion-3-5",
prompt="a luminous forest at dusk, cinematic, award-winning photography",
size="1024x1024",
n=1
)
for img in result.data:
print(f"Generated: {img.url}")
That's it. The response contains a url field with a CDN-hosted link to your generated image. The URL is valid for 30 days.
Next steps
- Browse the API Reference for all available endpoints and parameters
- Explore code examples for Python, Node.js, and curl
- See the pricing page to understand credit costs per operation