API Crear clave

YouTube

Shorts de historias

Algo gracioso que te ha pasado, contado por tu versión en dibujos animados, en seis planos

Desde
240 crpor anuncio
Endpoint
POST /api/v1/studio/storytime/runs
Id del flujo
storytime

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/storytime/estimate \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "card": "story",
    "inputs": {"plan": "{\"hero\": \"a young woman with a short black bob, big round eyes, a plain green hoodie, light blue jeans and white sneakers\", \"place\": \"a small cosy studio apartment with a sunny window, a sofa and a little kitchen\", \"title\": \"The plant\", \"shots\": [{\"shows\": \"The hero stands in the middle of the apartment proudly holding up a small potted plant with both hands, beaming.\", \"line\": \"Compré una planta para demostrar que soy un adulto responsable.\"}, {\"shows\": \"The hero pours water from a big watering can into the pot until it overflows onto the floor, nodding seriously.\", \"line\": \"La regaba todos los días. Dos veces, por si acaso.\"}, {\"shows\": \"The plant droops. The hero carries it to the window and sets it in the blazing sunshine, then fans it with a hand.\", \"line\": \"Empezó a decaer, así que le di más sol.\"}, {\"shows\": \"The hero pulls the plant up by its stem and the whole thing lifts out of the soil in one stiff piece, with a plastic base and no roots. The hero'\''s eyes go wide.\", \"line\": \"Entonces descubrí que es de plástico.\"}, {\"shows\": \"The hero sits on the floor beside a puddle of water, holding the dripping plastic plant, staring at it.\", \"line\": \"Llevo tres semanas enteras regando una planta falsa.\"}, {\"shows\": \"The hero hugs the plastic plant to their chest on the sofa\", \"line\": \"Y la verdad, es lo único que he mantenido con vida.\"}]}"}
  }' | 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/storytime/runs \
  -H "Authorization: Bearer $STAGLIGHT_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "card": "story",
    "inputs": {"plan": "{\"hero\": \"a young woman with a short black bob, big round eyes, a plain green hoodie, light blue jeans and white sneakers\", \"place\": \"a small cosy studio apartment with a sunny window, a sofa and a little kitchen\", \"title\": \"The plant\", \"shots\": [{\"shows\": \"The hero stands in the middle of the apartment proudly holding up a small potted plant with both hands, beaming.\", \"line\": \"Compré una planta para demostrar que soy un adulto responsable.\"}, {\"shows\": \"The hero pours water from a big watering can into the pot until it overflows onto the floor, nodding seriously.\", \"line\": \"La regaba todos los días. Dos veces, por si acaso.\"}, {\"shows\": \"The plant droops. The hero carries it to the window and sets it in the blazing sunshine, then fans it with a hand.\", \"line\": \"Empezó a decaer, así que le di más sol.\"}, {\"shows\": \"The hero pulls the plant up by its stem and the whole thing lifts out of the soil in one stiff piece, with a plastic base and no roots. The hero'\''s eyes go wide.\", \"line\": \"Entonces descubrí que es de plástico.\"}, {\"shows\": \"The hero sits on the floor beside a puddle of water, holding the dripping plastic plant, staring at it.\", \"line\": \"Llevo tres semanas enteras regando una planta falsa.\"}, {\"shows\": \"The hero hugs the plastic plant to their chest on the sofa\", \"line\": \"Y la verdad, es lo único que he mantenido con vida.\"}]}"},
    "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/storytime/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/storytime/runs/$ID/outputs.zip" -H "Authorization: Bearer $STAGLIGHT_API_KEY"

Cuánto cuesta

PlantillaFinal, mejor textoBorrador, rápido y barato
Short de historia480 cr240 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 story
inputs.ideaTu idea string
inputs.planEl plan string
inputs.drawHistoria sorpresa string
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