CLI un SDK

@sketchie/sdk TypeScript klients un sketchie komandrinda ir plāni, tipizēti ietinumi pār vienu un to pašu HTTP API. Abi nolasa jūsu atslēgu no SKETCHIE_API_KEY un pēc noklusējuma dodas uz https://sketchie.ai/api.

SDK un CLI tiek piegādāti kā daļa no Sketchie rīkkopas. Ja jūsu reģistrs vēl neatrisina paketi, varat tos palaist no Sketchie repozitorija ar bun. Neapstrādāts HTTP API šodien darbojas no jebkuras valodas.

TypeScript SDK

Izveidojiet klientu, ģenerējiet skaidrojumu ar draudzīgiem laukiem un gaidiet renderēšanu.

sketchie.ts
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

Rediģēšanas un atkārtotas renderēšanas cikls

Rediģējamības ķīlis: pabeigts skaidrojums atgriež savu sceneGraph. Apstipriniet to ar editExplainerGraph, lai pievienotu versiju, neizmantojot vēl vienu bezmaksas video izveides vietu, vai nosūtiet instrukciju vienkāršā valodā. Katra video pirmā atkārtotā renderēšana ir bezmaksas. Vēlākas atkārtotas renderēšanas izmanto maksas plāna minūtes.

edit.ts
// 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);

Balsu uzskaitīšana

voices.ts
const voices = await client.listVoices();
// [{ id: 'sketchie:sulafat', name: 'Nora', isDefault: true, preview_url, ... }]

Citas metodes: getExplainer, listExplainers, revertExplainer, duplicateExplainer, un deleteExplainer.

Komandrinda

Terminal
# 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

Karodziņi un vide

KarodziņšNozīme
--length <M:SS|sec> Mērķa garums, piem. 0:30, 1:00, vai sekundes. Pozitīvs 30 daudzkārtnis. Izlaidiet automātiskajam.
--aspect <ratio> 16:9 (noklusējums), 9:16, vai 1:1.
--voice <ref> Balss atsauce (skatiet sketchie voices). Neobligāts; noklusējums Nora.
--limit <n> Maksimālās rindas list, 1 līdz 100 (noklusējums 50).
--wait Aptaujā, līdz renderēšana beidzas vai neizdodas.
--json Mašīnlasāma izvade stdout.
--api-url <url> API pamata URL, ieskaitot /api prefiksu. Env: SKETCHIE_API_URL.
--api-key <key> Jūsu API atslēga. Env: SKETCHIE_API_KEY. Nekad netiek izdrukāta izvadē.