CLIとSDK

@sketchie/sdk TypeScriptクライアントとsketchieコマンドラインは、同じHTTP APIの薄い型付きラッパーです。どちらもSKETCHIE_API_KEYからキーを読み取り、デフォルトはhttps://sketchie.ai/apiです。

SDKとCLIはSketchieツールキットの一部として提供されます。レジストリがまだパッケージを解決できない場合、bunを使ってSketchieリポジトリから実行できます。生のHTTP APIは今日どの言語からでも動作します。

TypeScript SDK

クライアントを作成し、フレンドリーなフィールドで解説動画を生成し、レンダリングを待ちます。

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

編集と再レンダリングのループ

編集可能性のくさび: 完成した解説動画はそのsceneGraphを返します。editExplainerGraphでコミットして、無料動画作成枠を消費せずにバージョンを追加するか、平易な言葉での指示を送信します。各動画の最初の再レンダリングは無料です。それ以降の再レンダリングは有料プランの分数を使用します。

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

ボイスの一覧表示

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

その他のメソッド: getExplainerlistExplainersrevertExplainerduplicateExplainerdeleteExplainer

コマンドライン

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

フラグと環境

フラグ意味
--length <M:SS|sec> 目標の長さ、例: 0:301:00、または秒数。30の正の倍数。自動の場合は省略。
--aspect <ratio> 16:9(デフォルト)、9:16、または1:1
--voice <ref> ボイス参照(sketchie voicesを参照)。省略可能; デフォルトはNora。
--limit <n> listの最大行数、1〜100(デフォルト50)。
--wait レンダリングが完了または失敗するまでポーリングします。
--json stdoutへのマシン可読出力。
--api-url <url> /apiプレフィックスを含むAPIベースURL。環境変数: SKETCHIE_API_URL
--api-key <key> あなたのAPIキー。環境変数: SKETCHIE_API_KEY。出力に表示されることはありません。