API Crear clave

YouTube

Vídeos explicativos 3D

Una historia real, cómo funciona algo o qué pasaría si: lo cuenta un narrador en un mundo 3D de dibujos animados

Desde
248 crpor anuncio
Endpoint
POST /api/v1/studio/toon3d/runs
Id del flujo
toon3d

Resultados reales de este flujo.

La solicitud

# 1. Pide el precio. Gratis, no se cobra nada.
PRICE=$(curl -s -X POST https://staglight.ai/api/v1/studio/toon3d/estimate \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "card": "explain",
    "inputs": {"plan": "{\"title\": \"The summer London'\''s river stank\", \"world\": \"Victorian London in the hot summer of 1858: the brown river Thames, a stone bridge, the Houses of Parliament\", \"hero\": \"a Victorian engineer in a brown bowler hat, a dark green frock coat and a grey waistcoat\", \"check\": \"Julio y agosto de 1858, calor; aguas residuales sin tratar en el Támesis (Wikipedia: Great Stink)\\nLas cortinas del lado del río del Parlamento se empaparon en cloruro de cal\\nLa ley se presentó el 15 de junio de 1858 y se aprobó el 2 de agosto de 1858\\nLas cloacas de Bazalgette siguen funcionando en el siglo XXI\", \"shots\": [{\"shows\": \"the engineer and other Londoners stand on a stone bridge over the brown Thames under a blazing sun, holding their noses while wavy green stink lines rise from the water.\", \"line\": \"En 1858, el río de Londres olía tan mal que el Parlamento apenas podía trabajar.\"}, {\"shows\": \"old brick sewer pipes along the riverbank pour brown water straight into the Thames, flies buzz over the mud and the sun beats down on the city.\", \"line\": \"Fue un verano abrasador, y el Támesis estaba lleno de aguas negras.\"}, {\"shows\": \"inside a grand wood-panelled hall of Parliament, cartoon lawmakers in dark coats cough, gag and fan themselves with papers beside tall open windows facing the same brown, smelly river.\", \"line\": \"El hedor entraba directo a las salas de los diputados.\"}, {\"shows\": \"workers dip long heavy curtains into wooden buckets of white chloride of lime and hang them, dripping, over the tall windows on the river side, while the engineer watches hopefully.\", \"line\": \"Así que empaparon las cortinas en cloruro de cal.\"}, {\"shows\": \"a busy building site by the river: workers lay curved brick walls of a huge round sewer tunnel while the engineer unrolls a long paper plan of tunnels.\", \"line\": \"En pocas semanas, una nueva ley pagó una enorme red de cloacas.\"}, {\"shows\": \"the engineer stands proudly in a clean, softly lit brick sewer tunnel as fresh water flows past, then the camera rises through the street to London at dusk.\", \"line\": \"Esos túneles todavía sirven a Londres. ¿Habrías aguantado la respiración?\"}]}"}
  }' | jq .credits)
echo "$PRICE"

# 2. Inícialo. max_credits rechaza lo que pase de ese precio; el Idempotency-Key evita un cobro doble.
START=$(curl -s -X POST https://staglight.ai/api/v1/studio/toon3d/runs \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "card": "explain",
    "inputs": {"plan": "{\"title\": \"The summer London'\''s river stank\", \"world\": \"Victorian London in the hot summer of 1858: the brown river Thames, a stone bridge, the Houses of Parliament\", \"hero\": \"a Victorian engineer in a brown bowler hat, a dark green frock coat and a grey waistcoat\", \"check\": \"Julio y agosto de 1858, calor; aguas residuales sin tratar en el Támesis (Wikipedia: Great Stink)\\nLas cortinas del lado del río del Parlamento se empaparon en cloruro de cal\\nLa ley se presentó el 15 de junio de 1858 y se aprobó el 2 de agosto de 1858\\nLas cloacas de Bazalgette siguen funcionando en el siglo XXI\", \"shots\": [{\"shows\": \"the engineer and other Londoners stand on a stone bridge over the brown Thames under a blazing sun, holding their noses while wavy green stink lines rise from the water.\", \"line\": \"En 1858, el río de Londres olía tan mal que el Parlamento apenas podía trabajar.\"}, {\"shows\": \"old brick sewer pipes along the riverbank pour brown water straight into the Thames, flies buzz over the mud and the sun beats down on the city.\", \"line\": \"Fue un verano abrasador, y el Támesis estaba lleno de aguas negras.\"}, {\"shows\": \"inside a grand wood-panelled hall of Parliament, cartoon lawmakers in dark coats cough, gag and fan themselves with papers beside tall open windows facing the same brown, smelly river.\", \"line\": \"El hedor entraba directo a las salas de los diputados.\"}, {\"shows\": \"workers dip long heavy curtains into wooden buckets of white chloride of lime and hang them, dripping, over the tall windows on the river side, while the engineer watches hopefully.\", \"line\": \"Así que empaparon las cortinas en cloruro de cal.\"}, {\"shows\": \"a busy building site by the river: workers lay curved brick walls of a huge round sewer tunnel while the engineer unrolls a long paper plan of tunnels.\", \"line\": \"En pocas semanas, una nueva ley pagó una enorme red de cloacas.\"}, {\"shows\": \"the engineer stands proudly in a clean, softly lit brick sewer tunnel as fresh water flows past, then the camera rises through the street to London at dusk.\", \"line\": \"Esos túneles todavía sirven a Londres. ¿Habrías aguantado la respiración?\"}]}"},
    "max_credits": '"$PRICE"'
  }')

ID=$(echo "$START" | jq -r .id)

# 3. Espera a que termine.
while :; do
  STATUS=$(curl -s "https://staglight.ai/api/v1/studio/toon3d/runs/$ID" -H "Authorization: Bearer $STAGLIGHT_API_KEY" | jq -r .status)
  case "$STATUS" in succeeded|partial|failed) break ;; esac; sleep 10
done

# 4. Descarga todos los archivos en un zip.
curl -s -L -o result.zip "https://staglight.ai/api/v1/studio/toon3d/runs/$ID/outputs.zip" -H "Authorization: Bearer $STAGLIGHT_API_KEY"

Cuánto cuesta

PlantillaFinal, mejor textoBorrador, rápido y barato
Short explicativo488 cr248 cr

Precios del servidor con los ajustes por defecto. La llamada de estimación da el precio exacto para tus entradas, gratis.

Entradas

NombreTipoValores
cardLa plantilla string explain
inputs.ideaTu tema string
inputs.planEl plan string
inputs.drawHistoria sorpresa string
inputs.topicTipo de Short enum story, how, whatif
inputs.lengthDuración enum 30, 60
inputs.languageIdioma enum auto, en, es
qualityCalidad enum final, draft
aspectFormato enum 9:16, 16:9

Los archivos son ids de POST /api/v1/uploads. Ver la documentación

Pruébalo a mano

El mismo flujo funciona en el estudio, con el mismo saldo. Úsalo para ver el resultado antes de escribir código.

Regístrate para probarlo

Más flujos