CLI i SDK
Klient TypeScript @sketchie/sdk i wiersz poleceń sketchie to cienkie, typowane wrappery nad tym samym API HTTP. Oba odczytują twój klucz z SKETCHIE_API_KEY i domyślnie łączą się z https://sketchie.ai/api.
SDK i CLI są dostarczane jako część zestawu narzędzi Sketchie. Jeśli twój rejestr jeszcze nie rozwiązuje pakietu, możesz uruchomić je z repozytorium Sketchie za pomocą bun. Surowe API HTTP działa dziś z dowolnego języka.
SDK TypeScript
Utwórz klienta, wygeneruj objaśnienie za pomocą przyjaznych pól i poczekaj na renderowanie.
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 Pętla edycji i ponownego renderowania
Klin edytowalności: gotowe objaśnienie zwraca swój sceneGraph. Zatwierdź go za pomocą editExplainerGraph, aby dodać wersję bez zużywania kolejnego darmowego slotu tworzenia wideo, lub wyślij instrukcję w prostym języku. Pierwsze ponowne renderowanie każdego wideo jest darmowe. Kolejne wykorzystują minuty planu płatnego.
// 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); Wypisywanie głosów
const voices = await client.listVoices();
// [{ id: 'sketchie:sulafat', name: 'Nora', isDefault: true, preview_url, ... }] Inne metody: getExplainer, listExplainers, revertExplainer, duplicateExplainer, i deleteExplainer.
Wiersz poleceń
# 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 Flagi i środowisko
| Flaga | Znaczenie |
|---|---|
--length <M:SS|sec> | Docelowa długość, np. 0:30, 1:00, lub sekundy. Dodatnia wielokrotność 30. Pomiń dla auto. |
--aspect <ratio> | 16:9 (domyślnie), 9:16, lub 1:1. |
--voice <ref> | Ref głosu (zobacz sketchie voices). Opcjonalne; domyślnie Nora. |
--limit <n> | Maksymalna liczba wierszy dla list, 1 do 100 (domyślnie 50). |
--wait | Sprawdza aż renderowanie się zakończy lub nie powiedzie. |
--json | Wyjście czytelne maszynowo na stdout. |
--api-url <url> | Podstawowy URL API wraz z prefiksem /api. Env: SKETCHIE_API_URL. |
--api-key <key> | Twój klucz API. Env: SKETCHIE_API_KEY. Nigdy nie drukowany na wyjściu. |