CLI e SDK
O cliente TypeScript @sketchie/sdk e a liña de comandos sketchie son envoltorios finos e tipados sobre a mesma API HTTP. Ambos len a túa clave desde SKETCHIE_API_KEY e por defecto usan https://sketchie.ai/api.
O SDK e a CLI entréganse como parte do conxunto de ferramentas Sketchie. Se o teu rexistro aínda non resolve o paquete, podes executalos desde o repositorio Sketchie con bun. A API HTTP crúa funciona hoxe desde calquera linguaxe.
SDK TypeScript
Crea un cliente, xera unha explicación cos campos amigables e agarda o render.
import { SketchieClient } from '@sketchie/sdk';
const client = new SketchieClient({
apiKey: process.env.SKETCHIE_API_KEY, // Bearer sk_...
// baseUrl defaults to https://sketchie.ai/api
});
// Friendly fields: input (the topic) and length ("M:SS", a multiple of 30).
const created = await client.createExplainer({
input: 'Explain how DNS resolves a domain name',
length: '0:30',
aspect: '16:9',
});
// Poll until the render finishes (or fails).
const done = await client.waitForExplainer(created.id, {
onUpdate: (e) => console.log(e.status),
});
console.log(done.videoUrl); // the rendered MP4
console.log(done.sceneGraph); // the editable scene graph O bucle de edición e re-render
A cuña de editabilidade: unha explicación rematada devolve o seu sceneGraph. Confírmao con editExplainerGraph para engadir unha versión sen consumir outra praza de creación de vídeo gratuíta, ou envía unha instrución en linguaxe simple. O primeiro re-render de cada vídeo é gratuíto. Os seguintes usan minutos do plan de pago.
// After a video is ready you get back its editable sceneGraph.
// Edit it, then append a new version to the existing explainer.
const edited = editScenes(done.sceneGraph!); // your UI edits the graph
const rerender = await client.editExplainerGraph(done.id, edited);
await client.waitForVersion(done.id, rerender.id);
// Or apply a plain-language instruction (a targeted re-render):
const version = await client.editExplainer(done.id, 'make scene 2 shorter');
await client.waitForVersion(done.id, version.id); Listar voces
const voices = await client.listVoices();
// [{ id: 'sketchie:sulafat', name: 'Nora', isDefault: true, preview_url, ... }] Outros métodos: getExplainer, listExplainers, revertExplainer, duplicateExplainer, e deleteExplainer.
Liña de comandos
# Discover voices
sketchie voices
# Generate (returns the queued record immediately)
sketchie generate "Explain how DNS resolves a domain name" --length 0:30 --aspect 16:9
# Generate and wait for the finished render
sketchie generate "Explain how DNS resolves" --length 1:00 --wait
# Status of an existing explainer
sketchie status <id>
# Conversational edit (a targeted re-render)
sketchie edit <id> "make the title scene shorter" --wait
# List your explainers
sketchie list --limit 20 Bandeiras e contorno
| Bandeira | Significado |
|---|---|
--length <M:SS|sec> | Duración obxectivo, ex. 0:30, 1:00, ou segundos. Un múltiplo positivo de 30. Omite para automático. |
--aspect <ratio> | 16:9 (por defecto), 9:16, ou 1:1. |
--voice <ref> | Unha ref de voz (ver sketchie voices). Opcional; por defecto Nora. |
--limit <n> | Filas máximas para list, 1 a 100 (por defecto 50). |
--wait | Sondea ata que o render remate ou falle. |
--json | Saída lexible por máquina en stdout. |
--api-url <url> | URL base da API incluíndo o prefixo /api. Env: SKETCHIE_API_URL. |
--api-key <key> | A túa clave API. Env: SKETCHIE_API_KEY. Nunca impresa na saída. |