CLI 및 SDK
@sketchie/sdk TypeScript 클라이언트와 sketchie 명령줄은 동일한 HTTP API 위에 있는 얇고 타입이 지정된 래퍼입니다. 둘 다 SKETCHIE_API_KEY에서 키를 읽고 기본값은 https://sketchie.ai/api입니다.
SDK와 CLI는 Sketchie 툴킷의 일부로 제공됩니다. 레지스트리가 아직 패키지를 해결하지 못한 경우 bun으로 Sketchie 저장소에서 실행할 수 있습니다. 원시 HTTP API는 오늘날 어떤 언어에서도 작동합니다.
TypeScript SDK
클라이언트를 만들고, 친숙한 필드로 설명 영상을 생성하고, 렌더링을 기다립니다.
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로 커밋하여 무료 영상 생성 슬롯을 소비하지 않고 버전을 추가하거나, 평이한 언어 지시를 보내세요. 각 영상의 첫 재렌더링은 무료입니다. 이후 재렌더링은 유료 플랜 분을 사용합니다.
// 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); 음성 나열
const voices = await client.listVoices();
// [{ id: 'sketchie:sulafat', name: 'Nora', isDefault: true, preview_url, ... }] 기타 메서드: getExplainer, listExplainers, revertExplainer, duplicateExplainer, deleteExplainer.
명령줄
# 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:30, 1: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. 출력에 절대 표시되지 않습니다. |