/v1/creative-agent/workflows
Auth required
Single-step text-to-image. This example uses krea-2-turbo; select image models from GET /v1/model-catalog?mediaType=image. The OpenAI-compatible /v1/models endpoint lists LLMs, not image models.
$ curl https://api.sogni.ai/v1/creative-agent/workflows \
-H "Authorization: Bearer $SOGNI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"title": "Neon Tokyo alley",
"steps": [
{
"id": "image1",
"toolName": "generate_image",
"arguments": {
"prompt": "A cinematic neon-lit Tokyo alley during rain, shallow depth of field",
"model": "krea-2-turbo"
}
}
]
}
}'
const wf = await sogni.workflows.start({
input: {
title: 'Neon Tokyo alley',
steps: [
{
id: 'image1',
toolName: 'generate_image',
arguments: {
prompt: 'A cinematic neon-lit Tokyo alley during rain, shallow depth of field',
model: 'krea-2-turbo',
},
},
],
},
});
for await (const event of sogni.workflows.streamEvents(wf.workflowId)) {
if (event.type === 'workflow_completed') break;
}
import os, requests
resp = requests.post(
"https://api.sogni.ai/v1/creative-agent/workflows",
headers={"Authorization": f"Bearer {os.environ['SOGNI_API_KEY']}"},
json={
"input": {
"title": "Neon Tokyo alley",
"steps": [
{
"id": "image1",
"toolName": "generate_image",
"arguments": {
"prompt": "A cinematic neon-lit Tokyo alley during rain, shallow depth of field",
"model": "krea-2-turbo",
},
}
],
}
},
)
workflow = resp.json()["data"]["workflow"]
Poll GET /v1/creative-agent/workflows/:id or subscribe to /v1/creative-agent/workflows/:id/events/stream for the SSE event stream. The completed artifact URL is on workflow.steps[0].artifacts[0].url.