[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78ZC97AB0E0PPGJBJ0GZ88K":3,"skill-same:01M78ZC97AB0E0PPGJBJ0GZ88K":71},{"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":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":6,"ownerHtmlUrl":32,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":33,"install":34,"resources":46},"01M78ZC97AB0E0PPGJBJ0GZ88K","openai-specs",null,"Build and debug LitServe OpenAI-compatible chat completions and embeddings endpoints with OpenAISpec and OpenAIEmbeddingSpec.","VectorSpaceLab\u002FAREX-Skill","VectorSpaceLab","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F180637102?v=4","01M7538C5WPSJGWF7KHR4EFZ9F","01M7538C6R2GFP53NPXTCZNBRT",351,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Frepositories\u002Frepo-skills\u002Flitserve\u002Fsub-skills\u002Fopenai-specs\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: openai-specs\ndescription: \"Build and debug LitServe OpenAI-compatible chat completions and\n  embeddings endpoints with OpenAISpec and OpenAIEmbeddingSpec.\"\nmetadata:\n  disco-role: operating\ndisable-model-invocation: true\nlicense: Apache 2.0\n---\n\n# LitServe OpenAI-Compatible Specs\n\nUse this sub-skill when the user wants a LitServe server that looks like the\nOpenAI API, including `\u002Fv1\u002Fchat\u002Fcompletions`, `\u002Fv1\u002Fembeddings`, streaming chat,\ntool calls, `response_format`, image\u002Faudio chat messages, or embedding response\nshape debugging.\n\nFor the underlying LitServe server model, `LitAPI` lifecycle, `LitServer.run`,\nports, process settings, auth, middleware, and non-OpenAI routes, first load the\nroot LitServe router at `..\u002F..\u002FSKILL.md` and the server basics sub-skill at\n`..\u002Fserver-basics\u002FSKILL.md`.\n\nDo not use this sub-skill for MCP tool exposure, GPU\u002FTorch benchmark paths, or\nthroughput benchmark harnesses.\n\n## Router\n\n- **Chat completions**: use `OpenAISpec` for `\u002Fv1\u002Fchat\u002Fcompletions`.\n  - Implement `LitAPI.predict` as a generator, even when clients send\n    non-streaming requests.\n  - Return simple text by yielding strings, or return richer messages by yielding\n    dicts or `ChatMessage`-compatible objects with `role`, `content`,\n    `tool_calls`, and optional token usage keys.\n  - If you override `encode_response`, it must also be a generator in sync mode.\n- **Async chat completions**: set `enable_async=True` on the `LitAPI` and make\n  `predict` an async generator. `decode_request` may be sync or async;\n  overridden `encode_response` must yield from either a sync generator or async\n  generator.\n- **Streaming chat**: keep the server implementation generator-based. The client\n  request field `stream=True` selects SSE chunks; `stream=False` returns one\n  JSON `chat.completion` response assembled from the same generated messages.\n- **Tool calls**: yield a chat message with `tool_calls=[...]`; keep\n  `function.arguments` as a JSON string.\n- **Structured JSON output**: read `response_format` from the request\u002Fcontext and\n  yield JSON text yourself. LitServe accepts OpenAI-style `text`, `json_object`,\n  and `json_schema` request shapes, but it does not synthesize or validate model\n  JSON for you.\n- **Image and audio inputs**: accept `messages[*].content` as either text or a\n  list of content items. Image items use `image_url`; audio items use\n  `input_audio` with `format` limited to `wav` or `mp3`.\n- **Embeddings**: use `OpenAIEmbeddingSpec` for `\u002Fv1\u002Fembeddings`.\n  - `predict` and `encode_response` must return values, not generators.\n  - Return `{\"embeddings\": \u003Clist-of-vectors>}` from custom `encode_response`,\n    plus optional `prompt_tokens` and `total_tokens`.\n  - Client-side batching (a request with multiple input items) is allowed only\n    when server dynamic batching is not also enabled.\n- **OpenAI SDK compatibility**: keep the default spec paths. A custom\n  `api_path` registers the endpoint, but the OpenAI Python SDK only targets the\n  default `\u002Fv1\u002Fchat\u002Fcompletions` and `\u002Fv1\u002Fembeddings` paths through\n  `base_url=\"http:\u002F\u002Fhost:port\u002Fv1\"`.\n\n## Minimal implementation patterns\n\nChat completions:\n\n```python\nimport litserve as ls\nfrom litserve import OpenAISpec\n\nclass ChatAPI(ls.LitAPI):\n    def predict(self, request):\n        # request is a ChatCompletionRequest\n        yield \"This is a generated output\"\n\nif __name__ == \"__main__\":\n    api = ChatAPI(spec=OpenAISpec())\n    server = ls.LitServer(api)\n    server.run(port=8000)\n```\n\nEmbeddings:\n\n```python\nimport litserve as ls\nfrom litserve import OpenAIEmbeddingSpec\n\nclass EmbeddingAPI(ls.LitAPI):\n    def predict(self, inputs):\n        n = len(inputs) if isinstance(inputs, list) else 1\n        return [[0.0, 1.0, 0.5] for _ in range(n)]\n\n    def encode_response(self, output):\n        return {\"embeddings\": output}\n\nif __name__ == \"__main__\":\n    api = EmbeddingAPI(spec=OpenAIEmbeddingSpec())\n    server = ls.LitServer(api)\n    server.run(port=8000)\n```\n\nBundled runnable examples:\n\n- `scripts\u002Fopenai_chat_server.py` — chat completions server with streaming,\n  usage, tool-call, `response_format`, image, and audio request handling hooks.\n- `scripts\u002Fopenai_embedding_server.py` — deterministic embeddings server with\n  OpenAI-compatible response shape and optional usage accounting.\n\n## References\n\n- `references\u002Fapi-reference.md` — request\u002Fresponse models, endpoint paths,\n  response assembly rules, validation contracts, and import paths.\n- `references\u002Fworkflows.md` — implementation recipes for chat, streaming,\n  tool calls, JSON response format, multimodal messages, embeddings, batching,\n  and OpenAI SDK clients.\n- `references\u002Ftroubleshooting.md` — failure matrix for generator validation,\n  async mode, malformed outputs, embedding response rejection, multimodal\n  payload errors, batching conflicts, and custom path warnings.\n\n## Handoff checklist for future agents\n\nBefore claiming an OpenAI-compatible LitServe endpoint is ready:\n\n1. Confirm the correct spec is attached: `OpenAISpec()` for chat or\n   `OpenAIEmbeddingSpec()` for embeddings.\n2. Confirm the route is the spec default unless the user intentionally chose raw\n   HTTP over OpenAI SDK compatibility.\n3. For chat, confirm `predict` is generator-based and any custom\n   `encode_response` is generator-based.\n4. For async chat, confirm `enable_async=True` and `predict` is an async\n   generator.\n5. For embeddings, confirm no generator\u002Fyield is used and the response includes\n   an `embeddings` key with one vector per requested input item.\n6. Exercise both SDK-style clients and direct HTTP only within the user's target\n   environment; do not rely on repository checkout paths at runtime.\n","# LitServe OpenAI-Compatible Specs\n\nUse this sub-skill when the user wants a LitServe server that looks like the\nOpenAI API, including `\u002Fv1\u002Fchat\u002Fcompletions`, `\u002Fv1\u002Fembeddings`, streaming chat,\ntool calls, `response_format`, image\u002Faudio chat messages, or embedding response\nshape debugging.\n\nFor the underlying LitServe server model, `LitAPI` lifecycle, `LitServer.run`,\nports, process settings, auth, middleware, and non-OpenAI routes, first load the\nroot LitServe router at `..\u002F..\u002FSKILL.md` and the server basics sub-skill at\n`..\u002Fserver-basics\u002FSKILL.md`.\n\nDo not use this sub-skill for MCP tool exposure, GPU\u002FTorch benchmark paths, or\nthroughput benchmark harnesses.\n\n## Router\n\n- **Chat completions**: use `OpenAISpec` for `\u002Fv1\u002Fchat\u002Fcompletions`.\n  - Implement `LitAPI.predict` as a generator, even when clients send\n    non-streaming requests.\n  - Return simple text by yielding strings, or return richer messages by yielding\n    dicts or `ChatMessage`-compatible objects with `role`, `content`,\n    `tool_calls`, and optional token usage keys.\n  - If you override `encode_response`, it must also be a generator in sync mode.\n- **Async chat completions**: set `enable_async=True` on the `LitAPI` and make\n  `predict` an async generator. `decode_request` may be sync or async;\n  overridden `encode_response` must yield from either a sync generator or async\n  generator.\n- **Streaming chat**: keep the server implementation generator-based. The client\n  request field `stream=True` selects SSE chunks; `stream=False` returns one\n  JSON `chat.completion` response assembled from the same generated messages.\n- **Tool calls**: yield a chat message with `tool_calls=[...]`; keep\n  `function.arguments` as a JSON string.\n- **Structured JSON output**: read `response_format` from the request\u002Fcontext and\n  yield JSON text yourself. LitServe accepts OpenAI-style `text`, `json_object`,\n  and `json_schema` request shapes, but it does not synthesize or validate model\n  JSON for you.\n- **Image and audio inputs**: accept `messages[*].content` as either text or a\n  list of content items. Image items use `image_url`; audio items use\n  `input_audio` with `format` limited to `wav` or `mp3`.\n- **Embeddings**: use `OpenAIEmbeddingSpec` for `\u002Fv1\u002Fembeddings`.\n  - `predict` and `encode_response` must return values, not generators.\n  - Return `{\"embeddings\": \u003Clist-of-vectors>}` from custom `encode_response`,\n    plus optional `prompt_tokens` and `total_tokens`.\n  - Client-side batching (a request with multiple input items) is allowed only\n    when server dynamic batching is not also enabled.\n- **OpenAI SDK compatibility**: keep the default spec paths. A custom\n  `api_path` registers the endpoint, but the OpenAI Python SDK only targets the\n  default `\u002Fv1\u002Fchat\u002Fcompletions` and `\u002Fv1\u002Fembeddings` paths through\n  `base_url=\"http:\u002F\u002Fhost:port\u002Fv1\"`.\n\n## Minimal implementation patterns\n\nChat completions:\n\n```python\nimport litserve as ls\nfrom litserve import OpenAISpec\n\nclass ChatAPI(ls.LitAPI):\n    def predict(self, request):\n        # request is a ChatCompletionRequest\n        yield \"This is a generated output\"\n\nif __name__ == \"__main__\":\n    api = ChatAPI(spec=OpenAISpec())\n    server = ls.LitServer(api)\n    server.run(port=8000)\n```\n\nEmbeddings:\n\n```python\nimport litserve as ls\nfrom litserve import OpenAIEmbeddingSpec\n\nclass EmbeddingAPI(ls.LitAPI):\n    def predict(self, inputs):\n        n = len(inputs) if isinstance(inputs, list) else 1\n        return [[0.0, 1.0, 0.5] for _ in range(n)]\n\n    def encode_response(self, output):\n        return {\"embeddings\": output}\n\nif __name__ == \"__main__\":\n    api = EmbeddingAPI(spec=OpenAIEmbeddingSpec())\n    server = ls.LitServer(api)\n    server.run(port=8000)\n```\n\nBundled runnable examples:\n\n- `scripts\u002Fopenai_chat_server.py` — chat completions server with streaming,\n  usage, tool-call, `response_format`, image, and audio request handling hooks.\n- `scripts\u002Fopenai_embedding_server.py` — deterministic embeddings server with\n  OpenAI-compatible response shape and optional usage accounting.\n\n## References\n\n- `references\u002Fapi-reference.md` — request\u002Fresponse models, endpoint paths,\n  response assembly rules, validation contracts, and import paths.\n- `references\u002Fworkflows.md` — implementation recipes for chat, streaming,\n  tool calls, JSON response format, multimodal messages, embeddings, batching,\n  and OpenAI SDK clients.\n- `references\u002Ftroubleshooting.md` — failure matrix for generator validation,\n  async mode, malformed outputs, embedding response rejection, multimodal\n  payload errors, batching conflicts, and custom path warnings.\n\n## Handoff checklist for future agents\n\nBefore claiming an OpenAI-compatible LitServe endpoint is ready:\n\n1. Confirm the correct spec is attached: `OpenAISpec()` for chat or\n   `OpenAIEmbeddingSpec()` for embeddings.\n2. Confirm the route is the spec default unless the user intentionally chose raw\n   HTTP over OpenAI SDK compatibility.\n3. For chat, confirm `predict` is generator-based and any custom\n   `encode_response` is generator-based.\n4. For async chat, confirm `enable_async=True` and `predict` is an async\n   generator.\n5. For embeddings, confirm no generator\u002Fyield is used and the response includes\n   an `embeddings` key with one vector per requested input item.\n6. Exercise both SDK-style clients and direct HTTP only within the user's target\n   environment; do not rely on repository checkout paths at runtime.\n",{"name":5,"license":23,"metadata":24,"description":7,"disable-model-invocation":26},"Apache 2.0",{"disco-role":25},"operating",true,"main","ac3fe1afa80fb9a09775ecfb2b6cc3ba850a2db6","skills\u002Frepositories\u002Frepo-skills\u002Flitserve\u002Fsub-skills\u002Fopenai-specs",27,"https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill","https:\u002F\u002Fgithub.com\u002FVectorSpaceLab","2026-09-03 10:25:21",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":26},[36,39,42],{"tool":37,"command":38},"npx","npx skills add VectorSpaceLab\u002FAREX-Skill --skill openai-specs",{"tool":40,"command":41},"bunx","bunx skills add VectorSpaceLab\u002FAREX-Skill --skill openai-specs",{"tool":43,"command":44},"pnpm","pnpm dlx skills add VectorSpaceLab\u002FAREX-Skill --skill openai-specs","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Frepositories\u002Frepo-skills\u002Flitserve\u002Fsub-skills\u002Fopenai-specs\u002FSKILL.md",[47,53,57,61,67],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"references\u002Fapi-reference.md","REFERENCE","参考文档",10303,"https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Frepositories\u002Frepo-skills\u002Flitserve\u002Fsub-skills\u002Fopenai-specs\u002Freferences\u002Fapi-reference.md",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"references\u002Ftroubleshooting.md",10133,"https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Frepositories\u002Frepo-skills\u002Flitserve\u002Fsub-skills\u002Fopenai-specs\u002Freferences\u002Ftroubleshooting.md",{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Fworkflows.md",10496,"https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Frepositories\u002Frepo-skills\u002Flitserve\u002Fsub-skills\u002Fopenai-specs\u002Freferences\u002Fworkflows.md",{"path":62,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":65,"sourceHtmlUrl":66},"scripts\u002Fopenai_chat_server.py","SCRIPT","脚本",6291,"https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Frepositories\u002Frepo-skills\u002Flitserve\u002Fsub-skills\u002Fopenai-specs\u002Fscripts\u002Fopenai_chat_server.py",{"path":68,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":69,"sourceHtmlUrl":70},"scripts\u002Fopenai_embedding_server.py",3867,"https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Frepositories\u002Frepo-skills\u002Flitserve\u002Fsub-skills\u002Fopenai-specs\u002Fscripts\u002Fopenai_embedding_server.py",[72,79,86,93,100,107],{"skillNo":73,"name":74,"nameZh":6,"description":75,"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},"01M799NYSH1R3RVAHSM2D88Y84","passnet-triton-opt","Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block\u002Fgrid\u002Fwarp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.","https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Ftask-oriented\u002FPassNet\u002Fskills\u002Fpassnet-triton-opt\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},"01M799NS5APEC0N1FZ7XZVW6BN","passnet-solve","END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.","https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Ftask-oriented\u002FPassNet\u002Fskills\u002Fpassnet-solve\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":18},"01M799NNY9BKSM21V5R7QVTBJX","passnet-skill","PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under .\u002Fpass_dir\u002F, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.","https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Ftask-oriented\u002FPassNet\u002Fskills\u002Fpassnet-skill\u002FSKILL.md",[],[],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":18},"01M799NHH6NP7Z1RK77KGXAN6S","passnet-pattern-fusion","Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()\u002Freplacement_args()\u002Freplacement_func() files, when a pass \"failed to match\", or when deciding how to fuse multiple kernels\u002Fops.","https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Ftask-oriented\u002FPassNet\u002Fskills\u002Fpassnet-pattern-fusion\u002FSKILL.md",[],[],{"skillNo":101,"name":102,"nameZh":6,"description":103,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":104,"categories":105,"keywords":106,"publishedAt":18},"01M799ND2J4WNC2PGAZ0A06NDF","passnet-orchestrate","Round\u002Fbatch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep\u002Frevert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.","https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Ftask-oriented\u002FPassNet\u002Fskills\u002Fpassnet-orchestrate\u002FSKILL.md",[],[],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":18},"01M799N8SBTMY02ZDG2AZF5ZWE","passnet-feedback","Fast, deterministic feedback for PassNet work: pre-flight pattern\u002Fmatch verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).","https:\u002F\u002Fgithub.com\u002FVectorSpaceLab\u002FAREX-Skill\u002Fblob\u002Fmain\u002Fskills\u002Ftask-oriented\u002FPassNet\u002Fskills\u002Fpassnet-feedback\u002FSKILL.md",[],[]]