CLI و SDK

کلاینت TypeScript @sketchie/sdk و خط فرمان sketchie لفاف‌های نازک و تایپ‌شده بر روی همان API HTTP هستند. هر دو کلید شما را از SKETCHIE_API_KEY می‌خوانند و به‌طور پیش‌فرض به https://sketchie.ai/api می‌روند.

SDK و CLI به‌عنوان بخشی از جعبه‌ابزار Sketchie ارسال می‌شوند. اگر رجیستری شما هنوز بسته را حل نکرده، می‌توانید آنها را از مخزن Sketchie با bun اجرا کنید. API HTTP خام امروزه از هر زبانی کار می‌کند.

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> یک ref صدا (به sketchie voices مراجعه کنید). اختیاری؛ پیش‌فرض Nora.
--limit <n> حداکثر ردیف برای list، 1 تا 100 (پیش‌فرض 50).
--wait تا پایان یا شکست رندر پایش می‌کند.
--json خروجی قابل‌خواندن توسط ماشین در stdout.
--api-url <url> آدرس پایه API شامل پیشوند /api. Env: SKETCHIE_API_URL.
--api-key <key> کلید API شما. Env: SKETCHIE_API_KEY. هرگز در خروجی چاپ نمی‌شود.