[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75BGESKZ8W2D223BYC6T093":3,"skill-same:01M75BGESKZ8W2D223BYC6T093":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M75BGESKZ8W2D223BYC6T093","javascript-sdk",null,"Build AI applications with the [inference.sh](https:\u002F\u002Finference.sh) JavaScript\u002FTypeScript SDK.","ruake\u002FAWARE","ruake","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F253885939?v=4","01M75AVBM7FRFTS61RZRNMZB6C","01M75AVBMYHD7500NHVANF1HKM",0,"MIT","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fjavascript-sdk\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: javascript-sdk\ndescription: Build AI applications with the [inference.sh](https:\u002F\u002Finference.sh) JavaScript\u002FTypeScript SDK.\n---\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 250+ 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","> **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 250+ 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",{"name":5,"description":7},"main","6184979e01f673905139589c194eab38198db2f7",".opencode\u002Fskills\u002Fjavascript-sdk",1,"https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE","https:\u002F\u002Fruake.github.io\u002FAWARE","https:\u002F\u002Fgithub.com\u002Fruake","2026-11-15 04:27:27",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ruake\u002FAWARE --skill javascript-sdk",{"tool":37,"command":38},"bunx","bunx skills add ruake\u002FAWARE --skill javascript-sdk",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ruake\u002FAWARE --skill javascript-sdk","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fjavascript-sdk\u002FSKILL.md",true,[],[46,52,59,66,73,79],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M75BPBYT89TEE87CGBDX2KF5","xlsx","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fxlsx\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M75BPA000S9MTH5MY7CZNYYQ","writing-plans","Write comprehensive implementation plans assuming the engineer has zero context for our codebase and questionable taste.","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M75BP80ETH9GYVRH8A7QPCSG","web-design-guidelines","Review files for compliance with Web Interface Guidelines.","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-design-guidelines\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M75BP5XG8SX5Q2WWZB6QRVFT","web-component-design","Build reusable, maintainable UI components using modern frameworks with clean composition patterns and styling approache","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-component-design\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":18},"01M75BP4B1FC4V81QR1VB56H1E","web-artifacts-builder","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":18},"01M75BP1XVRW8WQ2XXAJBAYV2V","vueuse-functions","This skill is a decision-and-implementation guide for VueUse composables in Vue.js \u002F Nuxt projects. It maps requirements","https:\u002F\u002Fgithub.com\u002Fruake\u002FAWARE\u002Fblob\u002Fmain\u002F.opencode\u002Fskills\u002Fvueuse-functions\u002FSKILL.md",[],[]]