CLI และ SDK

ไคลเอนต์ TypeScript @sketchie/sdk และบรรทัดคำสั่ง sketchie เป็น wrapper แบบบางที่มีชนิดข้อมูลบน HTTP API เดียวกัน ทั้งคู่อ่านคีย์ของคุณจาก SKETCHIE_API_KEY และค่าเริ่มต้นคือ https://sketchie.ai/api

SDK และ CLI จัดส่งมาเป็นส่วนหนึ่งของชุดเครื่องมือ Sketchie หากรีจิสทรีของคุณยังไม่สามารถแก้ไขแพ็กเกจได้ คุณสามารถรันได้จากที่เก็บ Sketchie ด้วย bun 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, ... }]

วิธีการอื่นๆ: getExplainer, listExplainers, revertExplainer, duplicateExplainer และ deleteExplainer

บรรทัดคำสั่ง

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: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> URL พื้นฐานของ API รวมถึงพรีฟิกซ์ /api Env: SKETCHIE_API_URL
--api-key <key> คีย์ API ของคุณ Env: SKETCHIE_API_KEY ไม่เคยพิมพ์ในเอาต์พุต