CLI మరియు SDK
@sketchie/sdk TypeScript క్లయింట్ మరియు sketchie కమాండ్ లైన్ అదే HTTP API పై సన్నని, టైప్ చేయబడిన wrapper లు. రెండూ 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> | ఒక వాయిస్ ref (sketchie voices చూడండి). ఐచ్ఛికం; డిఫాల్ట్ Nora. |
--limit <n> | list కోసం గరిష్ట వరుసలు, 1 నుండి 100 (డిఫాల్ట్ 50). |
--wait | రెండరింగ్ పూర్తయ్యే లేదా విఫలమయ్యే వరకు పోల్ చేస్తుంది. |
--json | stdout పై యంత్రం-చదవగల అవుట్పుట్. |
--api-url <url> | /api ప్రిఫిక్స్తో సహా API బేస్ URL. Env: SKETCHIE_API_URL. |
--api-key <key> | మీ API కీ. Env: SKETCHIE_API_KEY. అవుట్పుట్లో ఎప్పుడూ ప్రింట్ చేయబడదు. |