javascript-sdk

Integrate inference.sh AI apps and agents into JavaScript and TypeScript applications.

Updated Jul 28, 2026
One-click install
npx skills add https://github.com/Aadi-110i/PEP-PROJECT --skill javascript-sdk-aadi-110i
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: javascript-sdk
Source: https://github.com/Aadi-110i/PEP-PROJECT/tree/main/skills/javascript-sdk
Command: npx skills add https://github.com/Aadi-110i/PEP-PROJECT --skill javascript-sdk-aadi-110i

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @inferencesh/sdk, and includes references (resource) components.

What problem does it solve? Building AI features into JavaScript or TypeScript applications requires handling API authentication, file uploads, streaming responses, and agent orchestration manually. This Skill provides the complete reference for the @inferencesh/sdk package, letting you run 250+ AI models, build agents with tools, and stream results without writing boilerplate integration code. ## Core Features & Use Cases - Run AI Apps: Execute any inference.sh app with typed inputs, fire-and-forget tasks, streaming progress updates, and stateful sessions that keep workers warm. - Agent SDK: Create template or ad-hoc agents with a tool builder API supporting client tools, app tools, sub-agent delegation, webhooks, and human approval workflows. - Frontend Integration: Secure server proxy handlers for Next.js, Express, Hono, Remix, and SvelteKit keep API keys off the browser, with React hooks for chat, streaming, and file uploads. - Use Case: Build a Next.js app where users upload an image, an agent analyzes it with a vision model, and results stream back to the UI in real time. ## Quick Start Install the @inferencesh/sdk npm package and use the JavaScript SDK skill to run an AI app or build an agent in my TypeScript project.

Frequently Asked Questions about javascript-sdk

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run an AI model from JavaScript or TypeScript?

Install @inferencesh/sdk via npm, create a client with your API key, and call client.run with an app ID and input object. The SDK returns the task output and supports streaming progress updates for long-running tasks.

How do I build an AI agent with tools in Node.js?

Use the SDK's tool builder API to define client tools, app tools, webhook tools, or sub-agent tools with typed parameters, then pass them to client.agent with a core model like Claude Sonnet 4. Handle tool calls via the onToolCall callback in sendMessage.

Can I use the inference.sh SDK in a browser or React app?

Yes, but never expose your API key in browser code. Configure the client with a proxyUrl pointing to a server proxy route, using the provided handlers for Next.js, Express, Hono, Remix, or SvelteKit.

Does the JavaScript SDK support streaming responses?

Yes, pass stream: true to client.run to receive an async iterable of status updates, logs, and progress. Agents stream message content through the onMessage callback, and streams can be cancelled with an AbortController.

How do I upload files with the inference.sh SDK?

Call client.uploadFile with a file path in Node.js or a File or Blob object in the browser. Local paths in run inputs are auto-uploaded, and agents accept files as buffers, base64 data URIs, or browser File objects.

What are sessions in the inference.sh SDK and when should I use them?

Sessions keep workers warm between requests, avoiding cold starts and preserving state like loaded models or open browsers. Create one with session: 'new', reuse the returned session_id, and set a session_timeout between 1 and 3600 seconds.