javascript-sdk▌
inferen-sh/skills · updated Apr 8, 2026
JavaScript/TypeScript SDK for running AI apps, building agents, and integrating 150+ models.
- ›Supports running AI apps with basic execution, fire-and-forget, and streaming progress modes; includes automatic file upload and stateful sessions to keep workers warm across calls
- ›Agent SDK enables both template-based agents from your workspace and ad-hoc agents with custom tools, system prompts, and temperature control
- ›Tool builder API provides four tool types: client tools (run in your cod
JavaScript SDK
Build AI applications with the inference.sh JavaScript/TypeScript SDK.

Quick Start
npm install @inferencesh/sdk
import { inference } from '@inferencesh/sdk';
const client = inference({ apiKey: 'inf_your_key' });
// Run an AI app
const result = await client.run({
app: 'infsh/flux-schnell',
input: { prompt: 'A sunset over mountains' }
});
console.log(result.output);
Installation
npm install @inferencesh/sdk
# or
yarn add @inferencesh/sdk
# or
pnpm add @inferencesh/sdk
Requirements: Node.js 18.0.0+ (or modern browser with fetch)
Authentication
import { inference } from '@inferencesh/sdk';
// Direct API key
const client = inference({ apiKey: 'inf_your_key' });
// From environment variable (recommended)
const client = inference({ apiKey: process.env.INFERENCE_API_KEY });
// For frontend apps (use proxy)
const client = inference({ proxyUrl: '/api/inference/proxy' });
Get your API key: Settings → API Keys → Create API Key
Running Apps
Basic Execution
const result = await client.run({
app: 'infsh/flux-schnell',
input: { prompt: 'A cat astronaut' }
});
console.log(result.status); // "completed"
console.log(result.output); // Output data
Fire and Forget
const task = await client.run({
app: 'google/veo-3-1-fast',
input: { prompt: 'Drone flying over mountains' }
}, { wait: false });
console.log(`Task ID: ${task.id}`);
// Check later with client.getTask(task.id)
Streaming Progress
const stream = await client.run({
app: 'google/veo-3-1-fast',
input: { prompt: 'Ocean waves at sunset' }
}, { stream: true });
for await (const update of stream) {
console.log(`Status: ${update.status}`);
if (update.logs?.length) {
console.log(update.logs.at(-1));
}
}
Run Parameters
| Parameter | Type | Description |
|---|---|---|
app |
string | App ID (namespace/name@version) |
input |
object | Input matching app schema |
setup |
object | Hidden setup configuration |
infra |
string | 'cloud' or 'private' |
session |
string | Session ID for stateful execution |
session_timeout |
number | Idle timeout (1-3600 seconds) |
File Handling
Automatic Upload
const result = await client.run({
app: 'image-processor',
input: {
image: '/path/to/image.png' // Auto-uploaded
}
});
Manual Upload
// Basic upload
const file = await client.uploadFile('/path/to/image.png');
// With options
const file = await client.uploadFile('/path/to/image.png', {
filename: 'custom_name.png',
contentType: 'image/png',
public: true
});
const result = await client.run({
app: 'image-processor',
input: { image: file.uri }
});
Browser File Upload
const input = document.querySelector('input[type="file"]');
const file = await client.uploadFile(input.files[0]);
Sessions (Stateful Execution)
Keep workers warm across multiple calls:
// Start new session
const result = await client.run({
app: 'my-app',
input: { action: 'init' },
session: 'new',
session_timeout: 300 // 5 minutes
});
const sessionId = result.session_id;
// Continue in same session
const result2 = await client.run({
app: 'my-app',
input: { action: 'process' },
session: sessionId
});
Agent SDK
Template Agents
Use pre-built agents from your workspace:
const agent = client.agent('my-team/support-agent@latest');
// Send message
const response = await agent.sendMessage('Hello!');
console.log(response.text);
// Multi-turn conversation
const response2 = await agent.sendMessage('Tell me more');
// Reset conversation
agent.reset();
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
general reviewsRatings
4.8★★★★★40 reviews- ★★★★★Mei Gonzalez· Dec 24, 2024
javascript-sdk has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Chaitanya Patil· Dec 20, 2024
We added javascript-sdk from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Chinedu Rao· Dec 20, 2024
Keeps context tight: javascript-sdk is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Emma Chen· Dec 16, 2024
javascript-sdk reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Hassan Rahman· Nov 27, 2024
javascript-sdk reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Yuki Abebe· Nov 23, 2024
I recommend javascript-sdk for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Emma Garcia· Nov 15, 2024
Useful defaults in javascript-sdk — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
- ★★★★★Piyush G· Nov 11, 2024
javascript-sdk fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Hiroshi Bansal· Nov 11, 2024
javascript-sdk is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Kiara Iyer· Oct 18, 2024
I recommend javascript-sdk for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
showing 1-10 of 40
1 / 4