CLI և SDK

@sketchie/sdk TypeScript հաճախորդը և sketchie հրամանի տողը բարակ, տիպավորված փաթաթաններ են նույն 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> API հիմնական URL, ներառյալ /api նախածանցը: Env: SKETCHIE_API_URL:
--api-key <key> Ձեր API բանալին: Env: SKETCHIE_API_KEY: Երբեք չի տպագրվում ելքում: