quickstart

First render in five minutes

One key and one base URL cover every model in the catalog. Three steps.

  1. 1

    Get your API key

    Signed in on app.sogni.ai?

    Your key is one click away — it appears right here once you're signed in.

    Create free account

    Sogni issues one key per account, created the moment you ask for it. Account creation is free. Free Spark has account and model eligibility rules; do not assume it funds the API examples below.

    Keep it in an environment variable; every example below reads SOGNI_API_KEY. You can also manage the key at dashboard.sogni.ai.

  2. 2

    First image — check funding

    This Z-Image Turbo example requires eligible funding. Check your account and the current estimate before submitting it. For restricted-free API use, start with the agent guide. Install the SDK with npm i @sogni-ai/sogni-client, or go pure REST with the workflow endpoint.

    import { SogniClient } from '@sogni-ai/sogni-client';
    
    const client = await SogniClient.createInstance({
      appId: crypto.randomUUID(),
      apiKey: process.env.SOGNI_API_KEY,
      network: 'fast',
    });
    
    const project = await client.projects.create({
      type: 'image',
      modelId: 'z_image_turbo_bf16',
      positivePrompt: 'a slothicorn surfing a wave of liquid paint, studio lighting',
      numberOfMedia: 1,
    });
    
    const [url] = await project.waitForCompletion();
    console.log(url); // result link — download within 24h
  3. 3

    First video & first song

    Same key, same shape. LTX-2.3 generates a five-second clip with native audio for ~$0.07; ACE-Step writes a 30-second track for half a cent.

    import { SogniClient } from '@sogni-ai/sogni-client';
    
    const client = await SogniClient.createInstance({
      appId: crypto.randomUUID(),
      apiKey: process.env.SOGNI_API_KEY,
      network: 'fast',
    });
    
    const project = await client.projects.create({
      type: 'video',
      modelId: 'ltx23-22b-fp8_t2v_distilled',
      positivePrompt: 'a slothicorn surfing a wave of liquid paint, slow push-in, cinematic',
      numberOfMedia: 1,
      duration: 5,
    });
    
    const [url] = await project.waitForCompletion();
    console.log(url); // result link — download within 24h
    import { SogniClient } from '@sogni-ai/sogni-client';
    
    const client = await SogniClient.createInstance({
      appId: crypto.randomUUID(),
      apiKey: process.env.SOGNI_API_KEY,
      network: 'fast',
    });
    
    const project = await client.projects.create({
      type: 'audio',
      modelId: 'ace_step_1.5_turbo',
      positivePrompt: 'dreamy synthwave with a warm bassline',
      lyrics: undefined, // omit for instrumental
      numberOfMedia: 1,
      duration: 30,
    });
    
    const [url] = await project.waitForCompletion();
    console.log(url); // result link — download within 24h

Always know the price first

Every modality has a public estimate endpoint returning Spark and USD — the same quotes this site shows on every model page. Durable workflows can also require cost confirmation before they run (confirm_cost).

# Know the price first — estimates are free, no auth required.
# 5s of LTX-2.3 at 720p:
curl 'https://socket.sogni.ai/api/v1/job-video/estimate/spark/ltx23-22b-fp8_t2v_distilled/1280/720/121/24/8/1'
# → { "quote": { "project": { "costInSpark": "13.8…", "costInUSD": "0.069…" } } }

Go deeper

Base URL https://api.sogni.ai · results are stored for 24 hours — download what you want to keep · NSFW filter is on by default for API renders.