CLI ແລະ SDK
@sketchie/sdk TypeScript client ແລະ sketchie command line ແມ່ນ wrapper ບາງໆ, ມີປະເພດຢູ່ເທິງ HTTP API ດຽວກັນ. ທັງສອງອ່ານກະແຈຂອງທ່ານຈາກ SKETCHIE_API_KEY ແລະຄ່າເລີ່ມຕົ້ນໄປທີ່ https://sketchie.ai/api.
SDK ແລະ CLI ຖືກສົ່ງອອກເປັນສ່ວນໜຶ່ງຂອງຊຸດເຄື່ອງມື Sketchie. ຖ້າ registry ຂອງທ່ານຍັງບໍ່ແກ້ໄຂແພັກເກັດ, ທ່ານສາມາດແລ່ນພວກມັນຈາກ Sketchie repository ດ້ວຍ bun. HTTP API ດິບເຮັດວຽກຈາກພາສາໃດກໍໄດ້ໃນມື້ນີ້.
TypeScript SDK
ສ້າງ client, ສ້າງການອະທິບາຍດ້ວຍຟິວທີ່ເປັນມິດ, ແລະລໍຖ້າການສະແດງຜົນ.
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 ຂອງມັນ. Commit ມັນດ້ວຍ 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> | URL ພື້ນຖານ API ລວມທັງ prefix /api. Env: SKETCHIE_API_URL. |
--api-key <key> | ກະແຈ API ຂອງທ່ານ. Env: SKETCHIE_API_KEY. ບໍ່ເຄີຍພິມໃນຜົນອອກ. |