CLI a SDK

Klient TypeScript @sketchie/sdk a příkazová řádka sketchie jsou tenké, typované obaly nad stejným HTTP API. Oba čtou váš klíč z SKETCHIE_API_KEY a ve výchozím nastavení míří na https://sketchie.ai/api.

SDK a CLI se dodávají jako součást sady nástrojů Sketchie. Pokud váš registr ještě nerozpoznává balíček, můžete je spustit z repozitáře Sketchie pomocí bun. Syrové HTTP API dnes funguje z jakéhokoli jazyka.

TypeScript SDK

Vytvořte klienta, vygenerujte vysvětlení pomocí přátelských polí a počkejte na render.

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

Smyčka úprav a opětovného renderu

Klín upravitelnosti: dokončené vysvětlení vrací svůj sceneGraph. Potvrďte jej pomocí editExplainerGraph pro přidání verze bez spotřebování dalšího slotu pro bezplatné vytvoření videa, nebo pošlete instrukci v běžném jazyce. První opětovný render každého videa je zdarma. Pozdější opětovné rendery používají minuty placeného plánu.

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);

Výpis hlasů

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

Další metody: getExplainer, listExplainers, revertExplainer, duplicateExplainer, a deleteExplainer.

Příkazová řádka

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

Příznaky a prostředí

PříznakVýznam
--length <M:SS|sec> Cílová délka, např. 0:30, 1:00, nebo sekundy. Kladný násobek 30. Vynechte pro automatický.
--aspect <ratio> 16:9 (výchozí), 9:16, nebo 1:1.
--voice <ref> Odkaz na hlas (viz sketchie voices). Volitelné; výchozí Nora.
--limit <n> Maximální řádky pro list, 1 až 100 (výchozí 50).
--wait Dotazuje se, dokud render neskončí nebo neselže.
--json Strojově čitelný výstup na stdout.
--api-url <url> Základní URL API včetně předpony /api. Env: SKETCHIE_API_URL.
--api-key <key> Váš API klíč. Env: SKETCHIE_API_KEY. Nikdy se nevypisuje ve výstupu.