@skillmaster/sdk
v1.0.10
Published
Node.js SDK for SkillMaster API - AI-powered image/video generation, media analysis, and more
Downloads
118
Maintainers
Readme
@skillmaster/sdk
Node.js SDK for SkillMaster API - AI-powered image/video generation, media analysis, document processing, and more.
Installation
npm install @skillmaster/sdkQuick Start
import { SkillMasterClient } from '@skillmaster/sdk';
// Reads SKILLMASTER_API_KEY from environment variable
const client = new SkillMasterClient();
// Or with explicit config
const client = new SkillMasterClient({
apiKey: 'your-api-key',
baseUrl: 'https://skillmaster.fieldshortcut.com',
taskDir: './tasks',
timeout: 900000 // 15 minutes
});
// Generate image
const imageResult = await client.image.jimeng({
prompt: 'A beautiful sunset over mountains',
size: '2048x2048'
});
// Generate image with GPT Image
const gptImageResult = await client.image.gpt({
prompt: 'A clean ecommerce product photo',
aspect_ratio: '1:1',
size: '2K'
});
// Generate video (Kling)
const videoResult = await client.video.kling({
prompt: 'A cat playing piano',
model: 'kling-v2-6',
aspect_ratio: '16:9',
duration: '5'
});
// Generate video (Wan 3.0)
const wan3Result = await client.video.wan3({
action: 'reference',
prompt: 'A cinematic city flythrough',
resolution: '1080P',
ratio: 'adaptive',
duration: '5'
});
// Translate document (local file will be auto-uploaded to get tmp_url)
const docResult = await client.document.translate({
attachment: [{ path: './files/doc.pdf' }],
source_language: { value: 'en', label: 'English' },
target_language: { value: 'zh', label: 'Chinese' }
});
// Analyze media
const mediaResult = await client.media.analyze({
url: [{ link: 'https://youtube.com/watch?v=...' }]
});
// Video shot analysis
const shotAnalysisResult = await client.media.videoAnalysis({
attachment: [{ path: './video.mp4' }],
prompt: '拆解镜头、景别、节奏和叙事结构'
});Configuration
Environment Variables
SKILLMASTER_API_KEY- Your SkillMaster API keySKILLMASTER_BASE_URL- API base URL (optional, defaults to https://skillmaster.fieldshortcut.com)
CLI Configuration
Use the CLI to persist configuration:
# Install globally
npm install -g @skillmaster/sdk
# Set API key (stored in ~/.skillmaster/config.json)
skillmaster-sdk config set apiKey your-api-key
# Set custom base URL
skillmaster-sdk config set baseUrl https://custom.example.com
# View current configuration
skillmaster-sdk config
# Get a specific value
skillmaster-sdk config get apiKeyConfiguration Priority
- Constructor parameters (highest priority)
- Environment variables
- Config file (~/.skillmaster/config.json)
- Default values (lowest priority)
Task Folders
Each SDK execution creates a task folder with:
logs/request.json- Request detailslogs/response.json- API responselogs/execution.log- Execution logattachments/- Downloaded attachments (to avoid link expiration)
Default Task Directory
Tasks are stored in ~/Documents/tasks/ by default. You can override this:
const client = new UnityClawClient({
taskDir: '/path/to/custom/tasks'
});API Reference
Image Generation
// JiMeng
await client.image.jimeng({
prompt: 'A sunset over mountains',
size: '2048x2048'
});
// JiMeng (Doubao)
await client.image.jimeng({
prompt: 'A futuristic city',
model: 'v6.0'
});
// GPT Image
await client.image.gpt({
prompt: 'A premium product render',
aspect_ratio: '1:1',
size: '2K',
output_format: 'png'
});
// GPT Image Stable
await client.image.gptStable({
prompt: 'A crisp campaign visual',
aspect_ratio: '16:9',
quality: 'low',
output_format: 'webp'
});Video Generation
// Kling
await client.video.kling({
prompt: 'A dancing robot',
model: 'kling-v1-5'
});
// Wan 2.x
await client.video.wan({
prompt: 'A samurai in snowfall',
model: 'wan2.5-t2v',
size: '1280*720',
duration: '5'
});
// Wan 3.0
await client.video.wan3({
action: 'reference',
prompt: 'A model walking through a neon street',
resolution: '1080P',
ratio: 'adaptive',
duration: '5'
});
// Seedance 2.0 Mini
await client.video.seedance2Mini({
prompt: 'A playful product animation',
resolution: '720p',
ratio: '16:9'
});
// Seedance 2.5
await client.video.seedance25({
prompt: 'A longer travel montage',
resolution: '720p',
ratio: '21:9',
duration: '30'
});Document Processing
// Translate document
await client.document.translate({
attachment: [{ tmp_url: 'https://...', name: 'doc.pdf' }],
source_language: { value: 'en', label: 'English' },
target_language: { value: 'zh', label: 'Chinese' }
});
// Convert document
await client.document.convert({
attachment: [{ path: './files/doc.pdf' }],
input_format: 'pdf',
output_format: 'docx'
});Media Analysis
const result = await client.media.analyze({
url: [{ link: 'https://youtube.com/watch?v=...' }]
});
console.log(result.response.data?.summary);
console.log(result.response.data?.subtitle);
// Multi-language local media analysis
await client.media.analyzeLangs({
attachments: [{ path: './meeting.mp4' }]
});
// Video shot analysis
await client.media.videoAnalysis({
attachment: [{ path: './scene.mp4' }],
prompt: '拆解镜头、景别、声音、节奏和转场'
});Text
await client.text.gemini3({
prompt: 'Summarize this file',
attachment: [{ path: './brief.pdf' }]
});License
MIT
