[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77T7QW1V1P9SB0Z3APPTD97":3,"skill-same:01M77T7QW1V1P9SB0Z3APPTD97":80},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M77T7QW1V1P9SB0Z3APPTD97","javascript-sdk",null,"JavaScript\u002FTypeScript SDK for inference.sh - run AI apps, build agents, integrate with all models. Package: @inferencesh\u002Fsdk (npm install). Full TypeScript support, streaming, file uploads. Build agents with template or ad-hoc patterns, tool builder API, skills, human approval. Use for: JavaScript integration, TypeScript, Node.js, React, Next.js, frontend apps. Triggers: javascript sdk, typescript sdk, npm install, node.js api, js client, react ai, next.js ai, frontend sdk, @inferencesh\u002Fsdk, typescript agent, browser sdk, js integration","Reihantt6\u002Fsns-myagent","Reihantt6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F219822095?v=4","01M77KK94PV8B7C2D9XWXNS8DJ","Mohamad Reihan tegar prasetya","01M77KK958QFMTHYXGXFV7KZ79",2,"MIT","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fjavascript-sdk\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\ndescription: \"JavaScript\u002FTypeScript SDK for inference.sh - run AI apps, build agents, integrate with all models. Package: @inferencesh\u002Fsdk (npm install). Full TypeScript support, streaming, file uploads. Build agents with template or ad-hoc patterns, tool builder API, skills, human approval. Use for: JavaScript integration, TypeScript, Node.js, React, Next.js, frontend apps. Triggers: javascript sdk, typescript sdk, npm install, node.js api, js client, react ai, next.js ai, frontend sdk, @inferencesh\u002Fsdk, typescript agent, browser sdk, js integration\"\n---\n> **Install the belt CLI skill:** `npx skills add belt-sh\u002Fcli`\n\n# JavaScript SDK\n\nBuild AI applications with the [inference.sh](https:\u002F\u002Finference.sh) JavaScript\u002FTypeScript SDK.\n\n![JavaScript SDK](https:\u002F\u002Fcloud.inference.sh\u002Fapp\u002Ffiles\u002Fu\u002F4mg21r6ta37mpaz6ktzwtt8krr\u002F01kgvftjwhby36trvaj66bwzcf.jpeg)\n\n## Quick Start\n\n```bash\nnpm install @inferencesh\u002Fsdk\n```\n\n```typescript\nimport { inference } from '@inferencesh\u002Fsdk';\n\nconst client = inference({ apiKey: 'inf_your_key' });\n\n\u002F\u002F Run an AI app\nconst result = await client.run({\n  app: 'infsh\u002Fflux-schnell',\n  input: { prompt: 'A sunset over mountains' }\n});\nconsole.log(result.output);\n```\n\n## Installation\n\n```bash\nnpm install @inferencesh\u002Fsdk\n# or\nyarn add @inferencesh\u002Fsdk\n# or\npnpm add @inferencesh\u002Fsdk\n```\n\n**Requirements:** Node.js 18.0.0+ (or modern browser with fetch)\n\n## Authentication\n\n```typescript\nimport { inference } from '@inferencesh\u002Fsdk';\n\n\u002F\u002F Direct API key\nconst client = inference({ apiKey: 'inf_your_key' });\n\n\u002F\u002F From environment variable (recommended)\nconst client = inference({ apiKey: process.env.INFERENCE_API_KEY });\n\n\u002F\u002F For frontend apps (use proxy)\nconst client = inference({ proxyUrl: '\u002Fapi\u002Finference\u002Fproxy' });\n```\n\nGet your API key: Settings → API Keys → Create API Key\n\n## Running Apps\n\n### Basic Execution\n\n```typescript\nconst result = await client.run({\n  app: 'infsh\u002Fflux-schnell',\n  input: { prompt: 'A cat astronaut' }\n});\n\nconsole.log(result.status);  \u002F\u002F \"completed\"\nconsole.log(result.output);  \u002F\u002F Output data\n```\n\n### Fire and Forget\n\n```typescript\nconst task = await client.run({\n  app: 'google\u002Fveo-3-1-fast',\n  input: { prompt: 'Drone flying over mountains' }\n}, { wait: false });\n\nconsole.log(`Task ID: ${task.id}`);\n\u002F\u002F Check later with client.getTask(task.id)\n```\n\n### Streaming Progress\n\n```typescript\nconst stream = await client.run({\n  app: 'google\u002Fveo-3-1-fast',\n  input: { prompt: 'Ocean waves at sunset' }\n}, { stream: true });\n\nfor await (const update of stream) {\n  console.log(`Status: ${update.status}`);\n  if (update.logs?.length) {\n    console.log(update.logs.at(-1));\n  }\n}\n```\n\n### Run Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `app` | string | App ID (namespace\u002Fname@version) |\n| `input` | object | Input matching app schema |\n| `setup` | object | Hidden setup configuration |\n| `infra` | string | 'cloud' or 'private' |\n| `session` | string | Session ID for stateful execution |\n| `session_timeout` | number | Idle timeout (1-3600 seconds) |\n\n## File Handling\n\n### Automatic Upload\n\n```typescript\nconst result = await client.run({\n  app: 'image-processor',\n  input: {\n    image: '\u002Fpath\u002Fto\u002Fimage.png'  \u002F\u002F Auto-uploaded\n  }\n});\n```\n\n### Manual Upload\n\n```typescript\n\u002F\u002F Basic upload\nconst file = await client.uploadFile('\u002Fpath\u002Fto\u002Fimage.png');\n\n\u002F\u002F With options\nconst file = await client.uploadFile('\u002Fpath\u002Fto\u002Fimage.png', {\n  filename: 'custom_name.png',\n  contentType: 'image\u002Fpng',\n  public: true\n});\n\nconst result = await client.run({\n  app: 'image-processor',\n  input: { image: file.uri }\n});\n```\n\n### Browser File Upload\n\n```typescript\nconst input = document.querySelector('input[type=\"file\"]');\nconst file = await client.uploadFile(input.files[0]);\n```\n\n## Sessions (Stateful Execution)\n\nKeep workers warm across multiple calls:\n\n```typescript\n\u002F\u002F Start new session\nconst result = await client.run({\n  app: 'my-app',\n  input: { action: 'init' },\n  session: 'new',\n  session_timeout: 300  \u002F\u002F 5 minutes\n});\nconst sessionId = result.session_id;\n\n\u002F\u002F Continue in same session\nconst result2 = await client.run({\n  app: 'my-app',\n  input: { action: 'process' },\n  session: sessionId\n});\n```\n\n## Agent SDK\n\n### Template Agents\n\nUse pre-built agents from your workspace:\n\n```typescript\nconst agent = client.agent('my-team\u002Fsupport-agent@latest');\n\n\u002F\u002F Send message\nconst response = await agent.sendMessage('Hello!');\nconsole.log(response.text);\n\n\u002F\u002F Multi-turn conversation\nconst response2 = await agent.sendMessage('Tell me more');\n\n\u002F\u002F Reset conversation\nagent.reset();\n\n\u002F\u002F Get chat history\nconst chat = await agent.getChat();\n```\n\n### Ad-hoc Agents\n\nCreate custom agents programmatically:\n\n```typescript\nimport { tool, string, number, appTool } from '@inferencesh\u002Fsdk';\n\n\u002F\u002F Define tools\nconst calculator = tool('calculate')\n  .describe('Perform a calculation')\n  .param('expression', string('Math expression'))\n  .build();\n\nconst imageGen = appTool('generate_image', 'infsh\u002Fflux-schnell@latest')\n  .describe('Generate an image')\n  .param('prompt', string('Image description'))\n  .build();\n\n\u002F\u002F Create agent\nconst agent = client.agent({\n  core_app: { ref: 'infsh\u002Fclaude-sonnet-4@latest' },\n  system_prompt: 'You are a helpful assistant.',\n  tools: [calculator, imageGen],\n  temperature: 0.7,\n  max_tokens: 4096\n});\n\nconst response = await agent.sendMessage('What is 25 * 4?');\n```\n\n### Available Core Apps\n\n| Model | App Reference |\n|-------|---------------|\n| Claude Sonnet 4 | `infsh\u002Fclaude-sonnet-4@latest` |\n| Claude 3.5 Haiku | `infsh\u002Fclaude-haiku-35@latest` |\n| GPT-4o | `infsh\u002Fgpt-4o@latest` |\n| GPT-4o Mini | `infsh\u002Fgpt-4o-mini@latest` |\n\n## Tool Builder API\n\n### Parameter Types\n\n```typescript\nimport {\n  string, number, integer, boolean,\n  enumOf, array, obj, optional\n} from '@inferencesh\u002Fsdk';\n\nconst name = string('User\\'s name');\nconst age = integer('Age in years');\nconst score = number('Score 0-1');\nconst active = boolean('Is active');\nconst priority = enumOf(['low', 'medium', 'high'], 'Priority');\nconst tags = array(string('Tag'), 'List of tags');\nconst address = obj({\n  street: string('Street'),\n  city: string('City'),\n  zip: optional(string('ZIP'))\n}, 'Address');\n```\n\n### Client Tools (Run in Your Code)\n\n```typescript\nconst greet = tool('greet')\n  .display('Greet User')\n  .describe('Greets a user by name')\n  .param('name', string('Name to greet'))\n  .requireApproval()\n  .build();\n```\n\n### App Tools (Call AI Apps)\n\n```typescript\nconst generate = appTool('generate_image', 'infsh\u002Fflux-schnell@latest')\n  .describe('Generate an image from text')\n  .param('prompt', string('Image description'))\n  .setup({ model: 'schnell' })\n  .input({ steps: 20 })\n  .requireApproval()\n  .build();\n```\n\n### Agent Tools (Delegate to Sub-agents)\n\n```typescript\nimport { agentTool } from '@inferencesh\u002Fsdk';\n\nconst researcher = agentTool('research', 'my-org\u002Fresearcher@v1')\n  .describe('Research a topic')\n  .param('topic', string('Topic to research'))\n  .build();\n```\n\n### Webhook Tools (Call External APIs)\n\n```typescript\nimport { webhookTool } from '@inferencesh\u002Fsdk';\n\nconst notify = webhookTool('slack', 'https:\u002F\u002Fhooks.slack.com\u002F...')\n  .describe('Send Slack notification')\n  .secret('SLACK_SECRET')\n  .param('channel', string('Channel'))\n  .param('message', string('Message'))\n  .build();\n```\n\n### Internal Tools (Built-in Capabilities)\n\n```typescript\nimport { internalTools } from '@inferencesh\u002Fsdk';\n\nconst config = internalTools()\n  .plan()\n  .memory()\n  .webSearch(true)\n  .codeExecution(true)\n  .imageGeneration({\n    enabled: true,\n    appRef: 'infsh\u002Fflux@latest'\n  })\n  .build();\n\nconst agent = client.agent({\n  core_app: { ref: 'infsh\u002Fclaude-sonnet-4@latest' },\n  internal_tools: config\n});\n```\n\n## Streaming Agent Responses\n\n```typescript\nconst response = await agent.sendMessage('Explain quantum computing', {\n  onMessage: (msg) => {\n    if (msg.content) {\n      process.stdout.write(msg.content);\n    }\n  },\n  onToolCall: async (call) => {\n    console.log(`\\n[Tool: ${call.name}]`);\n    const result = await executeTool(call.name, call.args);\n    agent.submitToolResult(call.id, result);\n  }\n});\n```\n\n## File Attachments\n\n```typescript\n\u002F\u002F From file path (Node.js)\nimport { readFileSync } from 'fs';\nconst response = await agent.sendMessage('What\\'s in this image?', {\n  files: [readFileSync('image.png')]\n});\n\n\u002F\u002F From base64\nconst response = await agent.sendMessage('Analyze this', {\n  files: ['data:image\u002Fpng;base64,iVBORw0KGgo...']\n});\n\n\u002F\u002F From browser File object\nconst input = document.querySelector('input[type=\"file\"]');\nconst response = await agent.sendMessage('Describe this', {\n  files: [input.files[0]]\n});\n```\n\n## Skills (Reusable Context)\n\n```typescript\nconst agent = client.agent({\n  core_app: { ref: 'infsh\u002Fclaude-sonnet-4@latest' },\n  skills: [\n    {\n      name: 'code-review',\n      description: 'Code review guidelines',\n      content: '# Code Review\\n\\n1. Check security\\n2. Check performance...'\n    },\n    {\n      name: 'api-docs',\n      description: 'API documentation',\n      url: 'https:\u002F\u002Fexample.com\u002Fskills\u002Fapi-docs.md'\n    }\n  ]\n});\n```\n\n## Server Proxy (Frontend Apps)\n\nFor browser apps, proxy through your backend to keep API keys secure:\n\n### Client Setup\n\n```typescript\nconst client = inference({\n  proxyUrl: '\u002Fapi\u002Finference\u002Fproxy'\n  \u002F\u002F No apiKey needed on frontend\n});\n```\n\n### Next.js Proxy (App Router)\n\n```typescript\n\u002F\u002F app\u002Fapi\u002Finference\u002Fproxy\u002Froute.ts\nimport { createRouteHandler } from '@inferencesh\u002Fsdk\u002Fproxy\u002Fnextjs';\n\nconst route = createRouteHandler({\n  apiKey: process.env.INFERENCE_API_KEY\n});\n\nexport const POST = route.POST;\n```\n\n### Express Proxy\n\n```typescript\nimport express from 'express';\nimport { createProxyMiddleware } from '@inferencesh\u002Fsdk\u002Fproxy\u002Fexpress';\n\nconst app = express();\napp.use('\u002Fapi\u002Finference\u002Fproxy', createProxyMiddleware({\n  apiKey: process.env.INFERENCE_API_KEY\n}));\n```\n\n### Supported Frameworks\n\n- Next.js (App Router & Pages Router)\n- Express\n- Hono\n- Remix\n- SvelteKit\n\n## TypeScript Support\n\nFull type definitions included:\n\n```typescript\nimport type {\n  TaskDTO,\n  ChatDTO,\n  ChatMessageDTO,\n  AgentTool,\n  TaskStatusCompleted,\n  TaskStatusFailed\n} from '@inferencesh\u002Fsdk';\n\nif (result.status === TaskStatusCompleted) {\n  console.log('Done!');\n} else if (result.status === TaskStatusFailed) {\n  console.log('Failed:', result.error);\n}\n```\n\n## Error Handling\n\n```typescript\nimport { RequirementsNotMetException, InferenceError } from '@inferencesh\u002Fsdk';\n\ntry {\n  const result = await client.run({ app: 'my-app', input: {...} });\n} catch (e) {\n  if (e instanceof RequirementsNotMetException) {\n    console.log('Missing requirements:');\n    for (const err of e.errors) {\n      console.log(`  - ${err.type}: ${err.key}`);\n    }\n  } else if (e instanceof InferenceError) {\n    console.log('API error:', e.message);\n  }\n}\n```\n\n## Human Approval Workflows\n\n```typescript\nconst response = await agent.sendMessage('Delete all temp files', {\n  onToolCall: async (call) => {\n    if (call.requiresApproval) {\n      const approved = await promptUser(`Allow ${call.name}?`);\n      if (approved) {\n        const result = await executeTool(call.name, call.args);\n        agent.submitToolResult(call.id, result);\n      } else {\n        agent.submitToolResult(call.id, { error: 'Denied by user' });\n      }\n    }\n  }\n});\n```\n\n## CommonJS Support\n\n```javascript\nconst { inference, tool, string } = require('@inferencesh\u002Fsdk');\n\nconst client = inference({ apiKey: 'inf_...' });\nconst result = await client.run({...});\n```\n\n## Reference Files\n\n- [Agent Patterns](references\u002Fagent-patterns.md) - Multi-agent, RAG, batch processing patterns\n- [Tool Builder](references\u002Ftool-builder.md) - Complete tool builder API reference\n- [Server Proxy](references\u002Fserver-proxy.md) - Next.js, Express, Hono, Remix, SvelteKit setup\n- [Streaming](references\u002Fstreaming.md) - Real-time progress updates and SSE handling\n- [File Handling](references\u002Ffiles.md) - Upload, download, and manage files\n- [Sessions](references\u002Fsessions.md) - Stateful execution with warm workers\n- [TypeScript](references\u002Ftypescript.md) - Type definitions and type-safe patterns\n- [React Integration](references\u002Freact-integration.md) - Hooks, components, and patterns\n\n## Related Skills\n\n```bash\n# Python SDK\nnpx skills add inference-sh\u002Fskills@python-sdk\n\n# Full platform skill (all apps via CLI)\nnpx skills add inference-sh\u002Fskills@infsh-cli\n\n# LLM models\nnpx skills add inference-sh\u002Fskills@llm-models\n\n# Image generation\nnpx skills add inference-sh\u002Fskills@ai-image-generation\n```\n\n## Documentation\n\n- [JavaScript SDK Reference](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk-javascript) - Full API documentation\n- [Agent SDK Overview](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fagent-sdk) - Building agents\n- [Tool Builder Reference](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Finfsh-cli) - Creating tools\n- [Server Proxy Setup](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk\u002Fserver-proxy) - Frontend integration\n- [Authentication](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fauthentication) - API key setup\n- [Streaming](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk\u002Fstreaming) - Real-time updates\n- [File Uploads](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk\u002Ffiles) - File handling\n\n","> **Install the belt CLI skill:** `npx skills add belt-sh\u002Fcli`\n\n# JavaScript SDK\n\nBuild AI applications with the [inference.sh](https:\u002F\u002Finference.sh) JavaScript\u002FTypeScript SDK.\n\n![JavaScript SDK](https:\u002F\u002Fcloud.inference.sh\u002Fapp\u002Ffiles\u002Fu\u002F4mg21r6ta37mpaz6ktzwtt8krr\u002F01kgvftjwhby36trvaj66bwzcf.jpeg)\n\n## Quick Start\n\n```bash\nnpm install @inferencesh\u002Fsdk\n```\n\n```typescript\nimport { inference } from '@inferencesh\u002Fsdk';\n\nconst client = inference({ apiKey: 'inf_your_key' });\n\n\u002F\u002F Run an AI app\nconst result = await client.run({\n  app: 'infsh\u002Fflux-schnell',\n  input: { prompt: 'A sunset over mountains' }\n});\nconsole.log(result.output);\n```\n\n## Installation\n\n```bash\nnpm install @inferencesh\u002Fsdk\n# or\nyarn add @inferencesh\u002Fsdk\n# or\npnpm add @inferencesh\u002Fsdk\n```\n\n**Requirements:** Node.js 18.0.0+ (or modern browser with fetch)\n\n## Authentication\n\n```typescript\nimport { inference } from '@inferencesh\u002Fsdk';\n\n\u002F\u002F Direct API key\nconst client = inference({ apiKey: 'inf_your_key' });\n\n\u002F\u002F From environment variable (recommended)\nconst client = inference({ apiKey: process.env.INFERENCE_API_KEY });\n\n\u002F\u002F For frontend apps (use proxy)\nconst client = inference({ proxyUrl: '\u002Fapi\u002Finference\u002Fproxy' });\n```\n\nGet your API key: Settings → API Keys → Create API Key\n\n## Running Apps\n\n### Basic Execution\n\n```typescript\nconst result = await client.run({\n  app: 'infsh\u002Fflux-schnell',\n  input: { prompt: 'A cat astronaut' }\n});\n\nconsole.log(result.status);  \u002F\u002F \"completed\"\nconsole.log(result.output);  \u002F\u002F Output data\n```\n\n### Fire and Forget\n\n```typescript\nconst task = await client.run({\n  app: 'google\u002Fveo-3-1-fast',\n  input: { prompt: 'Drone flying over mountains' }\n}, { wait: false });\n\nconsole.log(`Task ID: ${task.id}`);\n\u002F\u002F Check later with client.getTask(task.id)\n```\n\n### Streaming Progress\n\n```typescript\nconst stream = await client.run({\n  app: 'google\u002Fveo-3-1-fast',\n  input: { prompt: 'Ocean waves at sunset' }\n}, { stream: true });\n\nfor await (const update of stream) {\n  console.log(`Status: ${update.status}`);\n  if (update.logs?.length) {\n    console.log(update.logs.at(-1));\n  }\n}\n```\n\n### Run Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| `app` | string | App ID (namespace\u002Fname@version) |\n| `input` | object | Input matching app schema |\n| `setup` | object | Hidden setup configuration |\n| `infra` | string | 'cloud' or 'private' |\n| `session` | string | Session ID for stateful execution |\n| `session_timeout` | number | Idle timeout (1-3600 seconds) |\n\n## File Handling\n\n### Automatic Upload\n\n```typescript\nconst result = await client.run({\n  app: 'image-processor',\n  input: {\n    image: '\u002Fpath\u002Fto\u002Fimage.png'  \u002F\u002F Auto-uploaded\n  }\n});\n```\n\n### Manual Upload\n\n```typescript\n\u002F\u002F Basic upload\nconst file = await client.uploadFile('\u002Fpath\u002Fto\u002Fimage.png');\n\n\u002F\u002F With options\nconst file = await client.uploadFile('\u002Fpath\u002Fto\u002Fimage.png', {\n  filename: 'custom_name.png',\n  contentType: 'image\u002Fpng',\n  public: true\n});\n\nconst result = await client.run({\n  app: 'image-processor',\n  input: { image: file.uri }\n});\n```\n\n### Browser File Upload\n\n```typescript\nconst input = document.querySelector('input[type=\"file\"]');\nconst file = await client.uploadFile(input.files[0]);\n```\n\n## Sessions (Stateful Execution)\n\nKeep workers warm across multiple calls:\n\n```typescript\n\u002F\u002F Start new session\nconst result = await client.run({\n  app: 'my-app',\n  input: { action: 'init' },\n  session: 'new',\n  session_timeout: 300  \u002F\u002F 5 minutes\n});\nconst sessionId = result.session_id;\n\n\u002F\u002F Continue in same session\nconst result2 = await client.run({\n  app: 'my-app',\n  input: { action: 'process' },\n  session: sessionId\n});\n```\n\n## Agent SDK\n\n### Template Agents\n\nUse pre-built agents from your workspace:\n\n```typescript\nconst agent = client.agent('my-team\u002Fsupport-agent@latest');\n\n\u002F\u002F Send message\nconst response = await agent.sendMessage('Hello!');\nconsole.log(response.text);\n\n\u002F\u002F Multi-turn conversation\nconst response2 = await agent.sendMessage('Tell me more');\n\n\u002F\u002F Reset conversation\nagent.reset();\n\n\u002F\u002F Get chat history\nconst chat = await agent.getChat();\n```\n\n### Ad-hoc Agents\n\nCreate custom agents programmatically:\n\n```typescript\nimport { tool, string, number, appTool } from '@inferencesh\u002Fsdk';\n\n\u002F\u002F Define tools\nconst calculator = tool('calculate')\n  .describe('Perform a calculation')\n  .param('expression', string('Math expression'))\n  .build();\n\nconst imageGen = appTool('generate_image', 'infsh\u002Fflux-schnell@latest')\n  .describe('Generate an image')\n  .param('prompt', string('Image description'))\n  .build();\n\n\u002F\u002F Create agent\nconst agent = client.agent({\n  core_app: { ref: 'infsh\u002Fclaude-sonnet-4@latest' },\n  system_prompt: 'You are a helpful assistant.',\n  tools: [calculator, imageGen],\n  temperature: 0.7,\n  max_tokens: 4096\n});\n\nconst response = await agent.sendMessage('What is 25 * 4?');\n```\n\n### Available Core Apps\n\n| Model | App Reference |\n|-------|---------------|\n| Claude Sonnet 4 | `infsh\u002Fclaude-sonnet-4@latest` |\n| Claude 3.5 Haiku | `infsh\u002Fclaude-haiku-35@latest` |\n| GPT-4o | `infsh\u002Fgpt-4o@latest` |\n| GPT-4o Mini | `infsh\u002Fgpt-4o-mini@latest` |\n\n## Tool Builder API\n\n### Parameter Types\n\n```typescript\nimport {\n  string, number, integer, boolean,\n  enumOf, array, obj, optional\n} from '@inferencesh\u002Fsdk';\n\nconst name = string('User\\'s name');\nconst age = integer('Age in years');\nconst score = number('Score 0-1');\nconst active = boolean('Is active');\nconst priority = enumOf(['low', 'medium', 'high'], 'Priority');\nconst tags = array(string('Tag'), 'List of tags');\nconst address = obj({\n  street: string('Street'),\n  city: string('City'),\n  zip: optional(string('ZIP'))\n}, 'Address');\n```\n\n### Client Tools (Run in Your Code)\n\n```typescript\nconst greet = tool('greet')\n  .display('Greet User')\n  .describe('Greets a user by name')\n  .param('name', string('Name to greet'))\n  .requireApproval()\n  .build();\n```\n\n### App Tools (Call AI Apps)\n\n```typescript\nconst generate = appTool('generate_image', 'infsh\u002Fflux-schnell@latest')\n  .describe('Generate an image from text')\n  .param('prompt', string('Image description'))\n  .setup({ model: 'schnell' })\n  .input({ steps: 20 })\n  .requireApproval()\n  .build();\n```\n\n### Agent Tools (Delegate to Sub-agents)\n\n```typescript\nimport { agentTool } from '@inferencesh\u002Fsdk';\n\nconst researcher = agentTool('research', 'my-org\u002Fresearcher@v1')\n  .describe('Research a topic')\n  .param('topic', string('Topic to research'))\n  .build();\n```\n\n### Webhook Tools (Call External APIs)\n\n```typescript\nimport { webhookTool } from '@inferencesh\u002Fsdk';\n\nconst notify = webhookTool('slack', 'https:\u002F\u002Fhooks.slack.com\u002F...')\n  .describe('Send Slack notification')\n  .secret('SLACK_SECRET')\n  .param('channel', string('Channel'))\n  .param('message', string('Message'))\n  .build();\n```\n\n### Internal Tools (Built-in Capabilities)\n\n```typescript\nimport { internalTools } from '@inferencesh\u002Fsdk';\n\nconst config = internalTools()\n  .plan()\n  .memory()\n  .webSearch(true)\n  .codeExecution(true)\n  .imageGeneration({\n    enabled: true,\n    appRef: 'infsh\u002Fflux@latest'\n  })\n  .build();\n\nconst agent = client.agent({\n  core_app: { ref: 'infsh\u002Fclaude-sonnet-4@latest' },\n  internal_tools: config\n});\n```\n\n## Streaming Agent Responses\n\n```typescript\nconst response = await agent.sendMessage('Explain quantum computing', {\n  onMessage: (msg) => {\n    if (msg.content) {\n      process.stdout.write(msg.content);\n    }\n  },\n  onToolCall: async (call) => {\n    console.log(`\\n[Tool: ${call.name}]`);\n    const result = await executeTool(call.name, call.args);\n    agent.submitToolResult(call.id, result);\n  }\n});\n```\n\n## File Attachments\n\n```typescript\n\u002F\u002F From file path (Node.js)\nimport { readFileSync } from 'fs';\nconst response = await agent.sendMessage('What\\'s in this image?', {\n  files: [readFileSync('image.png')]\n});\n\n\u002F\u002F From base64\nconst response = await agent.sendMessage('Analyze this', {\n  files: ['data:image\u002Fpng;base64,iVBORw0KGgo...']\n});\n\n\u002F\u002F From browser File object\nconst input = document.querySelector('input[type=\"file\"]');\nconst response = await agent.sendMessage('Describe this', {\n  files: [input.files[0]]\n});\n```\n\n## Skills (Reusable Context)\n\n```typescript\nconst agent = client.agent({\n  core_app: { ref: 'infsh\u002Fclaude-sonnet-4@latest' },\n  skills: [\n    {\n      name: 'code-review',\n      description: 'Code review guidelines',\n      content: '# Code Review\\n\\n1. Check security\\n2. Check performance...'\n    },\n    {\n      name: 'api-docs',\n      description: 'API documentation',\n      url: 'https:\u002F\u002Fexample.com\u002Fskills\u002Fapi-docs.md'\n    }\n  ]\n});\n```\n\n## Server Proxy (Frontend Apps)\n\nFor browser apps, proxy through your backend to keep API keys secure:\n\n### Client Setup\n\n```typescript\nconst client = inference({\n  proxyUrl: '\u002Fapi\u002Finference\u002Fproxy'\n  \u002F\u002F No apiKey needed on frontend\n});\n```\n\n### Next.js Proxy (App Router)\n\n```typescript\n\u002F\u002F app\u002Fapi\u002Finference\u002Fproxy\u002Froute.ts\nimport { createRouteHandler } from '@inferencesh\u002Fsdk\u002Fproxy\u002Fnextjs';\n\nconst route = createRouteHandler({\n  apiKey: process.env.INFERENCE_API_KEY\n});\n\nexport const POST = route.POST;\n```\n\n### Express Proxy\n\n```typescript\nimport express from 'express';\nimport { createProxyMiddleware } from '@inferencesh\u002Fsdk\u002Fproxy\u002Fexpress';\n\nconst app = express();\napp.use('\u002Fapi\u002Finference\u002Fproxy', createProxyMiddleware({\n  apiKey: process.env.INFERENCE_API_KEY\n}));\n```\n\n### Supported Frameworks\n\n- Next.js (App Router & Pages Router)\n- Express\n- Hono\n- Remix\n- SvelteKit\n\n## TypeScript Support\n\nFull type definitions included:\n\n```typescript\nimport type {\n  TaskDTO,\n  ChatDTO,\n  ChatMessageDTO,\n  AgentTool,\n  TaskStatusCompleted,\n  TaskStatusFailed\n} from '@inferencesh\u002Fsdk';\n\nif (result.status === TaskStatusCompleted) {\n  console.log('Done!');\n} else if (result.status === TaskStatusFailed) {\n  console.log('Failed:', result.error);\n}\n```\n\n## Error Handling\n\n```typescript\nimport { RequirementsNotMetException, InferenceError } from '@inferencesh\u002Fsdk';\n\ntry {\n  const result = await client.run({ app: 'my-app', input: {...} });\n} catch (e) {\n  if (e instanceof RequirementsNotMetException) {\n    console.log('Missing requirements:');\n    for (const err of e.errors) {\n      console.log(`  - ${err.type}: ${err.key}`);\n    }\n  } else if (e instanceof InferenceError) {\n    console.log('API error:', e.message);\n  }\n}\n```\n\n## Human Approval Workflows\n\n```typescript\nconst response = await agent.sendMessage('Delete all temp files', {\n  onToolCall: async (call) => {\n    if (call.requiresApproval) {\n      const approved = await promptUser(`Allow ${call.name}?`);\n      if (approved) {\n        const result = await executeTool(call.name, call.args);\n        agent.submitToolResult(call.id, result);\n      } else {\n        agent.submitToolResult(call.id, { error: 'Denied by user' });\n      }\n    }\n  }\n});\n```\n\n## CommonJS Support\n\n```javascript\nconst { inference, tool, string } = require('@inferencesh\u002Fsdk');\n\nconst client = inference({ apiKey: 'inf_...' });\nconst result = await client.run({...});\n```\n\n## Reference Files\n\n- [Agent Patterns](references\u002Fagent-patterns.md) - Multi-agent, RAG, batch processing patterns\n- [Tool Builder](references\u002Ftool-builder.md) - Complete tool builder API reference\n- [Server Proxy](references\u002Fserver-proxy.md) - Next.js, Express, Hono, Remix, SvelteKit setup\n- [Streaming](references\u002Fstreaming.md) - Real-time progress updates and SSE handling\n- [File Handling](references\u002Ffiles.md) - Upload, download, and manage files\n- [Sessions](references\u002Fsessions.md) - Stateful execution with warm workers\n- [TypeScript](references\u002Ftypescript.md) - Type definitions and type-safe patterns\n- [React Integration](references\u002Freact-integration.md) - Hooks, components, and patterns\n\n## Related Skills\n\n```bash\n# Python SDK\nnpx skills add inference-sh\u002Fskills@python-sdk\n\n# Full platform skill (all apps via CLI)\nnpx skills add inference-sh\u002Fskills@infsh-cli\n\n# LLM models\nnpx skills add inference-sh\u002Fskills@llm-models\n\n# Image generation\nnpx skills add inference-sh\u002Fskills@ai-image-generation\n```\n\n## Documentation\n\n- [JavaScript SDK Reference](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk-javascript) - Full API documentation\n- [Agent SDK Overview](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fagent-sdk) - Building agents\n- [Tool Builder Reference](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Finfsh-cli) - Creating tools\n- [Server Proxy Setup](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk\u002Fserver-proxy) - Frontend integration\n- [Authentication](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fauthentication) - API key setup\n- [Streaming](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk\u002Fstreaming) - Real-time updates\n- [File Uploads](https:\u002F\u002Finference.sh\u002Fdocs\u002Fapi\u002Fsdk\u002Ffiles) - File handling\n\n",{"description":7},"main","58843b159d7a4050d6b785a98b908cce505c0b92","agent\u002Fskills\u002Fjavascript-sdk",0,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent","https:\u002F\u002Fgithub.com\u002FReihantt6","reihsns.web.id","2026-08-19 20:08:18",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add Reihantt6\u002Fsns-myagent --skill javascript-sdk",{"tool":38,"command":39},"bunx","bunx skills add Reihantt6\u002Fsns-myagent --skill javascript-sdk",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Reihantt6\u002Fsns-myagent --skill javascript-sdk","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fjavascript-sdk\u002FSKILL.md",true,[46,52,56,60,64,68,72,76],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fagent-patterns.md","REFERENCE","参考文档",10157,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fjavascript-sdk\u002Freferences\u002Fagent-patterns.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Ffiles.md",9000,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fjavascript-sdk\u002Freferences\u002Ffiles.md",{"path":57,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":58,"sourceHtmlUrl":59},"references\u002Freact-integration.md",13492,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fjavascript-sdk\u002Freferences\u002Freact-integration.md",{"path":61,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":62,"sourceHtmlUrl":63},"references\u002Fserver-proxy.md",8596,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fjavascript-sdk\u002Freferences\u002Fserver-proxy.md",{"path":65,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":66,"sourceHtmlUrl":67},"references\u002Fsessions.md",8762,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fjavascript-sdk\u002Freferences\u002Fsessions.md",{"path":69,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":70,"sourceHtmlUrl":71},"references\u002Fstreaming.md",9501,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fjavascript-sdk\u002Freferences\u002Fstreaming.md",{"path":73,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":74,"sourceHtmlUrl":75},"references\u002Ftool-builder.md",10593,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fjavascript-sdk\u002Freferences\u002Ftool-builder.md",{"path":77,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Ftypescript.md",8045,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fjavascript-sdk\u002Freferences\u002Ftypescript.md",[81,88,95,102,109,116],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M77XDCYZ407XYMF2T4P6F7VT","youtube-transcript","Extract transcripts from YouTube videos. Use when the user asks for a transcript, subtitles, or captions of a YouTube video and provides a YouTube URL (youtube.com\u002Fwatch?v=, youtu.be\u002F, or similar). Supports output with or without timestamps.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-transcript\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M77XD7PBC98J6MXGJJ2TJ8DX","youtube-thumbnail-design","YouTube thumbnail design with specific dimensions, contrast rules, and mobile preview optimization. Covers safe zones, text placement, face expression psychology, and A\u002FB testing. Use for: YouTube thumbnails, video cover images, click-through optimization. Triggers: youtube thumbnail, thumbnail design, video thumbnail, click through rate, ctr optimization, youtube cover, video cover image, thumbnail maker, thumbnail tips, youtube design, video preview image","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-thumbnail-design\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M77XD2541C8HXJ6RHYZP4NGJ","youtube-short-maker","Make YouTube Shorts that hold attention with Pexo — vertical 9:16, fast-paced, hook in the first 3 seconds. Describe your topic and Pexo writes the script, generates the shots, picks the models, and assembles a finished Short with music and captions. Use for YouTube Shorts: \"youtube short\", \"make a youtube short\", \"shorts video\", \"short-form video\". NOT for long-form or landscape video.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fyoutube-short-maker\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":19},"01M77XCXKVSYK7KTZ3PQBVVGFD","xcode-project-setup","Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fxcode-project-setup\u002FSKILL.md",[],[],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":19},"01M77XCR1DV8ZQK2NHWKVY4EWX","x402","Set up Browser Use Cloud payments with x402 — pay per request from a crypto wallet (USDC on Base mainnet), no signup or API key. Two setups it works out up front — \"just use it\" (set up a wallet so you or Claude Code can run cloud browser tasks paid from the wallet — Claude writes and runs throwaway scripts, nothing touches your codebase) or \"build it in\" (install the SDK and write the key + code into your project). Walks through wallet setup, funding, .env, and a ~$1 test run. Use when the user asks about x402, pay-per-use, USDC payments, or wants Browser Use Cloud without an API key. For the free-tier signup (reverse-CAPTCHA → API key), use `browser-use cloud signup` or the `cloud` skill instead.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fx402\u002FSKILL.md",[],[],{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":122,"publishedAt":19},"01M77XCMD3R3ZBZQQSW6E0793B","x-twitter-scraper","Build GitHub Copilot workflows with Xquik X API SDKs, REST endpoints, hosted Apify Actor runs, MCP tools, TweetClaw OpenClaw plugin installs, signed webhooks, tweet search, user lookup, follower exports, media actions, and agent automation.","https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fx-twitter-scraper\u002FSKILL.md",[],[]]