{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "mirros-lab-code-as-world--serve-code-as-world-via-openai-api",
 "repo": "MirroS-Lab/Code-as-World",
 "repo_url": "https://github.com/MirroS-Lab/Code-as-World",
 "repo_slug": "mirros-lab-code-as-world",
 "title": "Serve a Code as World model behind an OpenAI-style API",
 "page_title": "How to serve a Code as World model behind an OpenAI-style API with Code as World",
 "summary": "Expose the 4B or 9B checkpoint through vLLM so other tools can send video requests to it.",
 "who": "A developer building an app or agent workflow that needs a physical reasoning model reachable through a standard chat API on their own GPU.",
 "problem": "Calling the checkpoints directly from custom Python code is awkward when the rest of the stack already speaks the OpenAI chat format.",
 "outcome": "A running vLLM server that hosts code-as-world-4b (or code-as-world-9b) through the OpenAI-compatible API.",
 "steps": [
  "Clone the repo with `git clone https://github.com/MirroS-Lab/Code-as-World.git`, run `cd Code-as-World`, create a environment with `python -m venv .venv`, activate it with `source .venv/bin/activate`, and run `pip install -r requirements/inference.txt`.",
  "Download the checkpoint with `hf download MirroS-Lab/Code-as-World-VL-4B --local-dir weights/4b`.",
  "Start the server with `CUDA_VISIBLE_DEVICES=0 vllm serve weights/4b --served-model-name code-as-world-4b --chat-template code_as_world/templates/qwen3_5_no_think.jinja`, adding the remaining flags from the README's OpenAI-compatible serving block (including `--media-io-kwargs`, `--mm-processor-kwargs`, and `--generation-config vllm`). (inferred, check the README)",
  "For the 9B checkpoint, swap `weights/4b` and `code-as-world-4b` for `weights/9b` and `code-as-world-9b`, and download it with `hf download MirroS-Lab/Code-as-World-VL-9B --local-dir weights/9b`."
 ],
 "agent_prompt": "In the Code-as-World repo at <repo_path>, start the vLLM server for weights/4b with the served model name code-as-world-4b using the flags in the README's OpenAI-compatible serving section. Then send one chat request containing <video_or_frames> and return the model's text reply. Verify that the server lists code-as-world-4b as an available model before sending the request.",
 "agents": [
  "any"
 ],
 "difficulty": "Advanced",
 "time": "1 hour",
 "basis": "readme",
 "caveat": "The README gives the serve command for a CUDA host and a specific chat template, so the server will not run as documented on other setups.",
 "category": "Research",
 "tags": [
  "Research"
 ],
 "lang": "python",
 "requirements": [
  "Python 3.10 or 3.11",
  "A CUDA host for the checkpoints",
  "git and the hf CLI to clone repos and download weights",
  "Disk space and network access for the 4B and 9B weights and the QuantiPhy validation videos"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/mirros-lab-code-as-world/serve-code-as-world-via-openai-api/",
 "md": "https://dedupedai.com/use-cases/mirros-lab-code-as-world/serve-code-as-world-via-openai-api/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/mirros-lab-code-as-world--serve-code-as-world-via-openai-api.json",
 "api_version": "v1"
}
