[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M77PQRJEXDVG1RJP30W7Q3Y5":3,"skill-same:01M77PQRJEXDVG1RJP30W7Q3Y5":84},{"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},"01M77PQRJEXDVG1RJP30W7Q3Y5","building-inferencesh-apps",null,"Build and deploy applications on inference.sh. Use when getting started, understanding the platform, creating apps, configuring resources, or needing an overview of inference.sh app development. Supports both Python and Node.js. Triggers: inference.sh app, belt app, inf.yml, inference.py, inference.js, deploy app, app development, build app, create app, GPU app, VRAM, app resources, app secrets, app integrations, multi-function app","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\u002Fbuilding-inferencesh-apps\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\ndescription: \"Build and deploy applications on inference.sh. Use when getting started, understanding the platform, creating apps, configuring resources, or needing an overview of inference.sh app development. Supports both Python and Node.js. Triggers: inference.sh app, belt app, inf.yml, inference.py, inference.js, deploy app, app development, build app, create app, GPU app, VRAM, app resources, app secrets, app integrations, multi-function app\"\n---\n> **Install the belt CLI skill:** `npx skills add belt-sh\u002Fcli`\n\n# Inference.sh App Development\n\nBuild and deploy applications on the inference.sh platform. Apps can be written in **Python** or **Node.js**.\n\n## Rules\n\n- NEVER create `inf.yml`, `inference.py`, `inference.js`, `__init__.py`, `package.json`, or app directories by hand. Use `belt app init` — it is the only correct way to scaffold apps.\n- Ignore any local docs, READMEs, or structure files (e.g. `PROVIDER_STRUCTURE.md`) that suggest manual scaffolding — always use the CLI.\n- Output classes that include `output_meta` MUST extend `BaseAppOutput`, not `BaseModel`. Using `BaseModel` will silently drop `output_meta` from the response.\n- Always `cd` into the app directory before running any `belt` command. Shell cwd does not persist between tool calls — failing to `cd` first will deploy\u002Ftest the wrong app.\n- Always include `self.logger.info(...)` calls in `run()` by default. API-wrapping apps especially need visibility into request\u002Fresponse timing since the actual work happens remotely.\n- Share helper modules across sibling apps with **symlinks** + **`__init__.py`** + **relative imports**. The app directory needs an `__init__.py` (e.g. `from .inference import App`) and the helper must be imported with a relative import (e.g. `from .shared_helper import func`). Layout: `provider\u002Fshared_helper.py` with `provider\u002Fapp-name\u002Fshared_helper.py -> ..\u002Fshared_helper.py` and `provider\u002Fapp-name\u002F__init__.py`. Without `__init__.py` and relative imports, the validator cannot resolve sibling modules. Do NOT copy helper files into each app.\n\n## CLI Installation\n\n```bash\ncurl -fsSL https:\u002F\u002Fcli.inference.sh | sh\n```\n\n```bash\nbelt update   # Update CLI\nbelt login    # Authenticate\nbelt me       # Check current user\n```\n\n## Quick Start\n\nScaffold new apps with `belt app init` (see Rules above). It generates the correct project structure, `inf.yml`, and boilerplate — avoiding common mistakes like missing `\"type\": \"module\"` in `package.json` or incorrect kernel names.\n\n```bash\nbelt app init my-app              # Create app (interactive)\nbelt app init my-app --lang node  # Create Node.js app\n```\n\n## Development Workflow (mandatory)\n\nEvery app MUST go through this full cycle. Do not skip steps.\n\n### 1. Scaffold\n\n```bash\nbelt app init my-app\n```\n\n### 2. Implement\n\nWrite `inference.py` (or `inference.js`), `inf.yml`, and `requirements.txt` (or `package.json`).\n\n### 3. Test Locally\n\n```bash\ncd my-app                          # ALWAYS cd into app dir first\nbelt app test --save-example      # Generate sample input from schema\nbelt app test                     # Run with input.json\nbelt app test --input '{\"prompt\": \"hello\"}'  # Or inline JSON\n```\n\n### 4. Deploy\n\n```bash\ncd my-app                          # cd again — cwd doesn't persist\nbelt app deploy --dry-run         # Validate first\nbelt app deploy                   # Deploy for real\n```\n\n### 5. Cloud Test & Verify\n\nAfter deploying, test the live version and verify `output_meta` is present in the response:\n\n```bash\nbelt app run user\u002Fapp --json --input '{\"prompt\": \"hello\"}'\n```\n\nCheck the JSON response for `output_meta` — if it's missing, the output class is likely extending `BaseModel` instead of `BaseAppOutput`.\n\n```bash\n# Other useful commands\nbelt app run user\u002Fapp --input input.json\nbelt app sample user\u002Fapp\nbelt app sample user\u002Fapp --save input.json\n```\n\n## App Structure\n\n### Python\n\n```python\nfrom inferencesh import BaseApp, BaseAppInput, BaseAppOutput\nfrom pydantic import Field\n\nclass AppSetup(BaseAppInput):\n    \"\"\"Setup parameters — triggers re-init when changed\"\"\"\n    model_id: str = Field(default=\"gpt2\", description=\"Model to load\")\n\nclass AppInput(BaseAppInput):\n    prompt: str = Field(description=\"Input prompt\")\n\nclass AppOutput(BaseAppOutput):\n    result: str = Field(description=\"Output result\")\n\nclass App(BaseApp):\n    async def setup(self, config: AppSetup):\n        \"\"\"Runs once when worker starts or config changes\"\"\"\n        self.model = load_model(config.model_id)\n\n    async def run(self, input_data: AppInput) -> AppOutput:\n        \"\"\"Default function — runs for each request\"\"\"\n        self.logger.info(f\"Processing prompt: {input_data.prompt[:50]}\")\n        result = self.model.generate(input_data.prompt)\n        self.logger.info(\"Generation complete\")\n        return AppOutput(result=result)\n\n    async def unload(self):\n        \"\"\"Cleanup on shutdown\"\"\"\n        pass\n\n    async def on_cancel(self):\n        \"\"\"Called when user cancels — for long-running tasks\"\"\"\n        return True\n```\n\n### Node.js\n\n```javascript\nimport { z } from \"zod\";\n\nexport const AppSetup = z.object({\n  modelId: z.string().default(\"gpt2\").describe(\"Model to load\"),\n});\n\nexport const RunInput = z.object({\n  prompt: z.string().describe(\"Input prompt\"),\n});\n\nexport const RunOutput = z.object({\n  result: z.string().describe(\"Output result\"),\n});\n\nexport class App {\n  async setup(config) {\n    \u002F** Runs once when worker starts or config changes *\u002F\n    this.model = loadModel(config.modelId);\n  }\n\n  async run(inputData) {\n    \u002F** Default function — runs for each request *\u002F\n    return { result: \"done\" };\n  }\n\n  async unload() {\n    \u002F** Cleanup on shutdown *\u002F\n  }\n\n  async onCancel() {\n    \u002F** Called when user cancels — for long-running tasks *\u002F\n    return true;\n  }\n}\n```\n\n## Multi-Function Apps\n\nApps can expose multiple functions with different input\u002Foutput schemas. Functions are auto-discovered.\n\n**Python:** Add methods with type-hinted Pydantic input\u002Foutput models.\n**Node.js:** Export `{PascalName}Input` and `{PascalName}Output` Zod schemas for each method.\n\nFunctions must be public (no `_` prefix) and not lifecycle methods (`setup`, `unload`, `on_cancel`\u002F`onCancel`, `constructor`).\n\nCall via API with `\"function\": \"method_name\"` in the request body. Set `default_function` in `inf.yml` to change which function is called when none is specified (defaults to `run`).\n\n## API-Wrapper App Template (Python)\n\nMost CPU-only apps that wrap external APIs follow this pattern. Use this as a starting point:\n\n```python\nimport os\nimport httpx\nfrom inferencesh import BaseApp, BaseAppInput, BaseAppOutput, File\nfrom inferencesh.models.usage import OutputMeta, ImageMeta  # or TextMeta, AudioMeta, etc.\nfrom pydantic import Field\n\nclass AppInput(BaseAppInput):\n    prompt: str = Field(description=\"Input prompt\")\n\nclass AppOutput(BaseAppOutput):  # NOT BaseModel — output_meta requires this\n    image: File = Field(description=\"Generated image\")\n\nclass App(BaseApp):\n    async def setup(self, config):\n        self.api_key = os.environ[\"API_KEY\"]\n        self.client = httpx.AsyncClient(timeout=120)\n\n    async def run(self, input_data: AppInput) -> AppOutput:\n        self.logger.info(f\"Calling API with prompt: {input_data.prompt[:80]}\")\n\n        response = await self.client.post(\n            \"https:\u002F\u002Fapi.example.com\u002Fgenerate\",\n            headers={\"Authorization\": f\"Bearer {self.api_key}\"},\n            json={\"prompt\": input_data.prompt},\n        )\n        response.raise_for_status()\n\n        # Write output file\n        output_path = \"\u002Ftmp\u002Foutput.png\"\n        with open(output_path, \"wb\") as f:\n            f.write(response.content)\n\n        # Read actual dimensions (don't hardcode!)\n        from PIL import Image\n        with Image.open(output_path) as img:\n            width, height = img.size\n\n        self.logger.info(f\"Generated {width}x{height} image\")\n\n        return AppOutput(\n            image=File(path=output_path),\n            output_meta=OutputMeta(\n                outputs=[ImageMeta(width=width, height=height, count=1)]\n            ),\n        )\n\n    async def unload(self):\n        await self.client.aclose()\n```\n\n## Configuring Resources (inf.yml)\n\n### Project Structure\n\n**Python:**\n```\nmy-app\u002F\n├── inf.yml           # Configuration\n├── inference.py      # App logic\n├── requirements.txt  # Python packages (pip)\n└── packages.txt      # System packages (apt) — optional\n```\n\n**Node.js:**\n```\nmy-app\u002F\n├── inf.yml           # Configuration\n├── src\u002F\n│   └── inference.js  # App logic\n├── package.json      # Node.js packages (npm\u002Fpnpm)\n└── packages.txt      # System packages (apt) — optional\n```\n\n### inf.yml\n\n```yaml\nname: my-app\ndescription: What my app does\ncategory: image\nkernel: python-3.11     # or node-22\n\n# For multi-function apps (default: run)\n# default_function: generate\n\nresources:\n  gpu:\n    count: 1\n    vram: 24    # 24GB (auto-converted)\n    type: any\n  ram: 32       # 32GB\n\nenv:\n  MODEL_NAME: gpt-4\n\nsecrets:\n  - key: HF_TOKEN\n    description: HuggingFace token for gated models\n    optional: false\n\nintegrations:\n  - key: google.sheets\n    description: Access to Google Sheets\n    optional: true\n```\n\n### Resource Units\n\nCLI auto-converts human-friendly values:\n- **\u003C 1000** → GB (e.g., `80` = 80GB)\n- **1000 to 1B** → MB\n\n### GPU Types\n\n`any` | `nvidia` | `amd` | `apple` | `none`\n\n> **Note:** Currently only NVIDIA CUDA GPUs are supported.\n\n### Categories\n\n`image` | `video` | `audio` | `text` | `chat` | `3d` | `other`\n\n### CPU-Only Apps\n\n```yaml\nresources:\n  gpu:\n    count: 0\n    type: none\n  ram: 4\n```\n\n### Dependencies\n\n**Python** — `requirements.txt`:\n```\ntorch>=2.0\ntransformers\naccelerate\n```\n\n**Node.js** — `package.json`:\n```json\n{\n  \"type\": \"module\",\n  \"dependencies\": {\n    \"zod\": \"^3.23.0\",\n    \"sharp\": \"^0.33.0\"\n  }\n}\n```\n\n**System packages** — `packages.txt` (apt-installable):\n```\nffmpeg\nlibgl1-mesa-glx\n```\n\n### Base Images\n\n| Type | Image |\n|------|-------|\n| GPU | `docker.inference.sh\u002Fgpu:latest-cuda` |\n| CPU | `docker.inference.sh\u002Fcpu:latest` |\n\n## GPU Apps\n\n**Always use `accelerate` for device detection** — `torch.cuda.is_available()` doesn't reliably detect GPUs in grid containers:\n\n```python\nfrom accelerate import Accelerator\n\naccelerator = Accelerator()\nself.device = accelerator.device\n```\n\n**For large models (>1B params), use `device_map`** to stream weights directly from disk to GPU, skipping CPU entirely. This is 7x faster than `from_pretrained` + `.to()` for large models:\n\n```python\n# Large models — streams disk → GPU directly\nself.model = AutoModel.from_pretrained(\"org\u002Fmodel\", dtype=torch.bfloat16, device_map=str(self.device))\n\n# Small models or unsupported libraries — load then move\nself.model = SomeModel.from_pretrained(\"org\u002Fmodel\")\nself.model = self.model.to(device=self.device, dtype=torch.float16)\n```\n\nRemember to add `accelerate` to `requirements.txt`.\n\n## Reference Files\n\nLoad the appropriate reference file based on the language and topic:\n\n### App Logic & Schemas\n- [references\u002Fpython-app-logic.md](references\u002Fpython-app-logic.md) — Python: Pydantic models, BaseApp, File handling, type hints, multi-function patterns\n- [references\u002Fnode-app-logic.md](references\u002Fnode-app-logic.md) — Node.js: Zod schemas, File handling, ESM, generators, multi-function patterns\n\n### Debugging, Optimization & Cancellation\n- [references\u002Fpython-patterns.md](references\u002Fpython-patterns.md) — Python: CUDA debugging, device detection, model loading, memory cleanup, mixed precision, cancellation\n- [references\u002Fnode-patterns.md](references\u002Fnode-patterns.md) — Node.js: ESM\u002Fimport debugging, streaming, memory management, concurrency, cancellation\n\n### Secrets & OAuth\n- [references\u002Fpython-secrets-oauth.md](references\u002Fpython-secrets-oauth.md) — Python: os.environ, OpenAI client, HuggingFace token, Google service account\n- [references\u002Fnode-secrets-oauth.md](references\u002Fnode-secrets-oauth.md) — Node.js: process.env, OpenAI client, Google credentials JSON\n\n### Usage Tracking\n- [references\u002Fpython-tracking.md](references\u002Fpython-tracking.md) — Python: OutputMeta, TextMeta, ImageMeta, VideoMeta, AudioMeta classes\n- [references\u002Fnode-tracking.md](references\u002Fnode-tracking.md) — Node.js: textMeta, imageMeta, videoMeta, audioMeta factory functions\n\n### CLI\n- [references\u002Fcli.md](references\u002Fcli.md) — Full CLI command reference, prerequisites for both languages\n\n## Resources\n\n- **Full Docs**: [inference.sh\u002Fdocs](https:\u002F\u002Finference.sh\u002Fdocs)\n- **Examples**: [github.com\u002Finference-sh\u002Fgrid](https:\u002F\u002Fgithub.com\u002Finference-sh\u002Fgrid)\n","> **Install the belt CLI skill:** `npx skills add belt-sh\u002Fcli`\n\n# Inference.sh App Development\n\nBuild and deploy applications on the inference.sh platform. Apps can be written in **Python** or **Node.js**.\n\n## Rules\n\n- NEVER create `inf.yml`, `inference.py`, `inference.js`, `__init__.py`, `package.json`, or app directories by hand. Use `belt app init` — it is the only correct way to scaffold apps.\n- Ignore any local docs, READMEs, or structure files (e.g. `PROVIDER_STRUCTURE.md`) that suggest manual scaffolding — always use the CLI.\n- Output classes that include `output_meta` MUST extend `BaseAppOutput`, not `BaseModel`. Using `BaseModel` will silently drop `output_meta` from the response.\n- Always `cd` into the app directory before running any `belt` command. Shell cwd does not persist between tool calls — failing to `cd` first will deploy\u002Ftest the wrong app.\n- Always include `self.logger.info(...)` calls in `run()` by default. API-wrapping apps especially need visibility into request\u002Fresponse timing since the actual work happens remotely.\n- Share helper modules across sibling apps with **symlinks** + **`__init__.py`** + **relative imports**. The app directory needs an `__init__.py` (e.g. `from .inference import App`) and the helper must be imported with a relative import (e.g. `from .shared_helper import func`). Layout: `provider\u002Fshared_helper.py` with `provider\u002Fapp-name\u002Fshared_helper.py -> ..\u002Fshared_helper.py` and `provider\u002Fapp-name\u002F__init__.py`. Without `__init__.py` and relative imports, the validator cannot resolve sibling modules. Do NOT copy helper files into each app.\n\n## CLI Installation\n\n```bash\ncurl -fsSL https:\u002F\u002Fcli.inference.sh | sh\n```\n\n```bash\nbelt update   # Update CLI\nbelt login    # Authenticate\nbelt me       # Check current user\n```\n\n## Quick Start\n\nScaffold new apps with `belt app init` (see Rules above). It generates the correct project structure, `inf.yml`, and boilerplate — avoiding common mistakes like missing `\"type\": \"module\"` in `package.json` or incorrect kernel names.\n\n```bash\nbelt app init my-app              # Create app (interactive)\nbelt app init my-app --lang node  # Create Node.js app\n```\n\n## Development Workflow (mandatory)\n\nEvery app MUST go through this full cycle. Do not skip steps.\n\n### 1. Scaffold\n\n```bash\nbelt app init my-app\n```\n\n### 2. Implement\n\nWrite `inference.py` (or `inference.js`), `inf.yml`, and `requirements.txt` (or `package.json`).\n\n### 3. Test Locally\n\n```bash\ncd my-app                          # ALWAYS cd into app dir first\nbelt app test --save-example      # Generate sample input from schema\nbelt app test                     # Run with input.json\nbelt app test --input '{\"prompt\": \"hello\"}'  # Or inline JSON\n```\n\n### 4. Deploy\n\n```bash\ncd my-app                          # cd again — cwd doesn't persist\nbelt app deploy --dry-run         # Validate first\nbelt app deploy                   # Deploy for real\n```\n\n### 5. Cloud Test & Verify\n\nAfter deploying, test the live version and verify `output_meta` is present in the response:\n\n```bash\nbelt app run user\u002Fapp --json --input '{\"prompt\": \"hello\"}'\n```\n\nCheck the JSON response for `output_meta` — if it's missing, the output class is likely extending `BaseModel` instead of `BaseAppOutput`.\n\n```bash\n# Other useful commands\nbelt app run user\u002Fapp --input input.json\nbelt app sample user\u002Fapp\nbelt app sample user\u002Fapp --save input.json\n```\n\n## App Structure\n\n### Python\n\n```python\nfrom inferencesh import BaseApp, BaseAppInput, BaseAppOutput\nfrom pydantic import Field\n\nclass AppSetup(BaseAppInput):\n    \"\"\"Setup parameters — triggers re-init when changed\"\"\"\n    model_id: str = Field(default=\"gpt2\", description=\"Model to load\")\n\nclass AppInput(BaseAppInput):\n    prompt: str = Field(description=\"Input prompt\")\n\nclass AppOutput(BaseAppOutput):\n    result: str = Field(description=\"Output result\")\n\nclass App(BaseApp):\n    async def setup(self, config: AppSetup):\n        \"\"\"Runs once when worker starts or config changes\"\"\"\n        self.model = load_model(config.model_id)\n\n    async def run(self, input_data: AppInput) -> AppOutput:\n        \"\"\"Default function — runs for each request\"\"\"\n        self.logger.info(f\"Processing prompt: {input_data.prompt[:50]}\")\n        result = self.model.generate(input_data.prompt)\n        self.logger.info(\"Generation complete\")\n        return AppOutput(result=result)\n\n    async def unload(self):\n        \"\"\"Cleanup on shutdown\"\"\"\n        pass\n\n    async def on_cancel(self):\n        \"\"\"Called when user cancels — for long-running tasks\"\"\"\n        return True\n```\n\n### Node.js\n\n```javascript\nimport { z } from \"zod\";\n\nexport const AppSetup = z.object({\n  modelId: z.string().default(\"gpt2\").describe(\"Model to load\"),\n});\n\nexport const RunInput = z.object({\n  prompt: z.string().describe(\"Input prompt\"),\n});\n\nexport const RunOutput = z.object({\n  result: z.string().describe(\"Output result\"),\n});\n\nexport class App {\n  async setup(config) {\n    \u002F** Runs once when worker starts or config changes *\u002F\n    this.model = loadModel(config.modelId);\n  }\n\n  async run(inputData) {\n    \u002F** Default function — runs for each request *\u002F\n    return { result: \"done\" };\n  }\n\n  async unload() {\n    \u002F** Cleanup on shutdown *\u002F\n  }\n\n  async onCancel() {\n    \u002F** Called when user cancels — for long-running tasks *\u002F\n    return true;\n  }\n}\n```\n\n## Multi-Function Apps\n\nApps can expose multiple functions with different input\u002Foutput schemas. Functions are auto-discovered.\n\n**Python:** Add methods with type-hinted Pydantic input\u002Foutput models.\n**Node.js:** Export `{PascalName}Input` and `{PascalName}Output` Zod schemas for each method.\n\nFunctions must be public (no `_` prefix) and not lifecycle methods (`setup`, `unload`, `on_cancel`\u002F`onCancel`, `constructor`).\n\nCall via API with `\"function\": \"method_name\"` in the request body. Set `default_function` in `inf.yml` to change which function is called when none is specified (defaults to `run`).\n\n## API-Wrapper App Template (Python)\n\nMost CPU-only apps that wrap external APIs follow this pattern. Use this as a starting point:\n\n```python\nimport os\nimport httpx\nfrom inferencesh import BaseApp, BaseAppInput, BaseAppOutput, File\nfrom inferencesh.models.usage import OutputMeta, ImageMeta  # or TextMeta, AudioMeta, etc.\nfrom pydantic import Field\n\nclass AppInput(BaseAppInput):\n    prompt: str = Field(description=\"Input prompt\")\n\nclass AppOutput(BaseAppOutput):  # NOT BaseModel — output_meta requires this\n    image: File = Field(description=\"Generated image\")\n\nclass App(BaseApp):\n    async def setup(self, config):\n        self.api_key = os.environ[\"API_KEY\"]\n        self.client = httpx.AsyncClient(timeout=120)\n\n    async def run(self, input_data: AppInput) -> AppOutput:\n        self.logger.info(f\"Calling API with prompt: {input_data.prompt[:80]}\")\n\n        response = await self.client.post(\n            \"https:\u002F\u002Fapi.example.com\u002Fgenerate\",\n            headers={\"Authorization\": f\"Bearer {self.api_key}\"},\n            json={\"prompt\": input_data.prompt},\n        )\n        response.raise_for_status()\n\n        # Write output file\n        output_path = \"\u002Ftmp\u002Foutput.png\"\n        with open(output_path, \"wb\") as f:\n            f.write(response.content)\n\n        # Read actual dimensions (don't hardcode!)\n        from PIL import Image\n        with Image.open(output_path) as img:\n            width, height = img.size\n\n        self.logger.info(f\"Generated {width}x{height} image\")\n\n        return AppOutput(\n            image=File(path=output_path),\n            output_meta=OutputMeta(\n                outputs=[ImageMeta(width=width, height=height, count=1)]\n            ),\n        )\n\n    async def unload(self):\n        await self.client.aclose()\n```\n\n## Configuring Resources (inf.yml)\n\n### Project Structure\n\n**Python:**\n```\nmy-app\u002F\n├── inf.yml           # Configuration\n├── inference.py      # App logic\n├── requirements.txt  # Python packages (pip)\n└── packages.txt      # System packages (apt) — optional\n```\n\n**Node.js:**\n```\nmy-app\u002F\n├── inf.yml           # Configuration\n├── src\u002F\n│   └── inference.js  # App logic\n├── package.json      # Node.js packages (npm\u002Fpnpm)\n└── packages.txt      # System packages (apt) — optional\n```\n\n### inf.yml\n\n```yaml\nname: my-app\ndescription: What my app does\ncategory: image\nkernel: python-3.11     # or node-22\n\n# For multi-function apps (default: run)\n# default_function: generate\n\nresources:\n  gpu:\n    count: 1\n    vram: 24    # 24GB (auto-converted)\n    type: any\n  ram: 32       # 32GB\n\nenv:\n  MODEL_NAME: gpt-4\n\nsecrets:\n  - key: HF_TOKEN\n    description: HuggingFace token for gated models\n    optional: false\n\nintegrations:\n  - key: google.sheets\n    description: Access to Google Sheets\n    optional: true\n```\n\n### Resource Units\n\nCLI auto-converts human-friendly values:\n- **\u003C 1000** → GB (e.g., `80` = 80GB)\n- **1000 to 1B** → MB\n\n### GPU Types\n\n`any` | `nvidia` | `amd` | `apple` | `none`\n\n> **Note:** Currently only NVIDIA CUDA GPUs are supported.\n\n### Categories\n\n`image` | `video` | `audio` | `text` | `chat` | `3d` | `other`\n\n### CPU-Only Apps\n\n```yaml\nresources:\n  gpu:\n    count: 0\n    type: none\n  ram: 4\n```\n\n### Dependencies\n\n**Python** — `requirements.txt`:\n```\ntorch>=2.0\ntransformers\naccelerate\n```\n\n**Node.js** — `package.json`:\n```json\n{\n  \"type\": \"module\",\n  \"dependencies\": {\n    \"zod\": \"^3.23.0\",\n    \"sharp\": \"^0.33.0\"\n  }\n}\n```\n\n**System packages** — `packages.txt` (apt-installable):\n```\nffmpeg\nlibgl1-mesa-glx\n```\n\n### Base Images\n\n| Type | Image |\n|------|-------|\n| GPU | `docker.inference.sh\u002Fgpu:latest-cuda` |\n| CPU | `docker.inference.sh\u002Fcpu:latest` |\n\n## GPU Apps\n\n**Always use `accelerate` for device detection** — `torch.cuda.is_available()` doesn't reliably detect GPUs in grid containers:\n\n```python\nfrom accelerate import Accelerator\n\naccelerator = Accelerator()\nself.device = accelerator.device\n```\n\n**For large models (>1B params), use `device_map`** to stream weights directly from disk to GPU, skipping CPU entirely. This is 7x faster than `from_pretrained` + `.to()` for large models:\n\n```python\n# Large models — streams disk → GPU directly\nself.model = AutoModel.from_pretrained(\"org\u002Fmodel\", dtype=torch.bfloat16, device_map=str(self.device))\n\n# Small models or unsupported libraries — load then move\nself.model = SomeModel.from_pretrained(\"org\u002Fmodel\")\nself.model = self.model.to(device=self.device, dtype=torch.float16)\n```\n\nRemember to add `accelerate` to `requirements.txt`.\n\n## Reference Files\n\nLoad the appropriate reference file based on the language and topic:\n\n### App Logic & Schemas\n- [references\u002Fpython-app-logic.md](references\u002Fpython-app-logic.md) — Python: Pydantic models, BaseApp, File handling, type hints, multi-function patterns\n- [references\u002Fnode-app-logic.md](references\u002Fnode-app-logic.md) — Node.js: Zod schemas, File handling, ESM, generators, multi-function patterns\n\n### Debugging, Optimization & Cancellation\n- [references\u002Fpython-patterns.md](references\u002Fpython-patterns.md) — Python: CUDA debugging, device detection, model loading, memory cleanup, mixed precision, cancellation\n- [references\u002Fnode-patterns.md](references\u002Fnode-patterns.md) — Node.js: ESM\u002Fimport debugging, streaming, memory management, concurrency, cancellation\n\n### Secrets & OAuth\n- [references\u002Fpython-secrets-oauth.md](references\u002Fpython-secrets-oauth.md) — Python: os.environ, OpenAI client, HuggingFace token, Google service account\n- [references\u002Fnode-secrets-oauth.md](references\u002Fnode-secrets-oauth.md) — Node.js: process.env, OpenAI client, Google credentials JSON\n\n### Usage Tracking\n- [references\u002Fpython-tracking.md](references\u002Fpython-tracking.md) — Python: OutputMeta, TextMeta, ImageMeta, VideoMeta, AudioMeta classes\n- [references\u002Fnode-tracking.md](references\u002Fnode-tracking.md) — Node.js: textMeta, imageMeta, videoMeta, audioMeta factory functions\n\n### CLI\n- [references\u002Fcli.md](references\u002Fcli.md) — Full CLI command reference, prerequisites for both languages\n\n## Resources\n\n- **Full Docs**: [inference.sh\u002Fdocs](https:\u002F\u002Finference.sh\u002Fdocs)\n- **Examples**: [github.com\u002Finference-sh\u002Fgrid](https:\u002F\u002Fgithub.com\u002Finference-sh\u002Fgrid)\n",{"description":7},"main","58843b159d7a4050d6b785a98b908cce505c0b92","agent\u002Fskills\u002Fbuilding-inferencesh-apps",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 building-inferencesh-apps",{"tool":38,"command":39},"bunx","bunx skills add Reihantt6\u002Fsns-myagent --skill building-inferencesh-apps",{"tool":41,"command":42},"pnpm","pnpm dlx skills add Reihantt6\u002Fsns-myagent --skill building-inferencesh-apps","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbuilding-inferencesh-apps\u002FSKILL.md",true,[46,52,56,60,64,68,72,76,80],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"references\u002Fcli.md","REFERENCE","参考文档",2782,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbuilding-inferencesh-apps\u002Freferences\u002Fcli.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fnode-app-logic.md",4907,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbuilding-inferencesh-apps\u002Freferences\u002Fnode-app-logic.md",{"path":57,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":58,"sourceHtmlUrl":59},"references\u002Fnode-patterns.md",5264,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbuilding-inferencesh-apps\u002Freferences\u002Fnode-patterns.md",{"path":61,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":62,"sourceHtmlUrl":63},"references\u002Fnode-secrets-oauth.md",3108,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbuilding-inferencesh-apps\u002Freferences\u002Fnode-secrets-oauth.md",{"path":65,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":66,"sourceHtmlUrl":67},"references\u002Fnode-tracking.md",2380,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbuilding-inferencesh-apps\u002Freferences\u002Fnode-tracking.md",{"path":69,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":70,"sourceHtmlUrl":71},"references\u002Fpython-app-logic.md",5009,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbuilding-inferencesh-apps\u002Freferences\u002Fpython-app-logic.md",{"path":73,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":74,"sourceHtmlUrl":75},"references\u002Fpython-patterns.md",6931,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbuilding-inferencesh-apps\u002Freferences\u002Fpython-patterns.md",{"path":77,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fpython-secrets-oauth.md",3362,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbuilding-inferencesh-apps\u002Freferences\u002Fpython-secrets-oauth.md",{"path":81,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fpython-tracking.md",3068,"https:\u002F\u002Fgithub.com\u002FReihantt6\u002Fsns-myagent\u002Fblob\u002Fmain\u002Fagent\u002Fskills\u002Fbuilding-inferencesh-apps\u002Freferences\u002Fpython-tracking.md",[85,92,99,106,113,120],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"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":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"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":100,"name":101,"nameZh":6,"description":102,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":103,"categories":104,"keywords":105,"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":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"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":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":117,"categories":118,"keywords":119,"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":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"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",[],[]]