Local AI is not a compromise, it's an unlimited AI.

Local AI is not a compromise, it’s an unlimited AI.

The problem and the fix In game development there are times you will want to automate a task with AI for example ChatGPT or Claude but they have limits then they charge you for more credits and because of the rammagedon barely anyone has 32 GB of ram which is enough to run a 14B model. Now if you were to switch to opencode you get models like big pickle but they also have credits and limits that reset monthly however you can actualy leverage opencode to your own advantage with local AI depending on your ram specs.

问题与解决方案 在游戏开发中,有时你会想要用 AI(例如 ChatGPT 或 Claude)来自动化任务,但它们存在限制,之后还会向你收取更多积分费用。由于内存短缺(rammagedon),几乎没人拥有运行 14B 模型所需的 32GB 内存。现在,如果你转向 opencode,你可以获得像 big pickle 这样的模型,但它们同样有每月重置的积分和限制。不过,根据你的内存规格,你实际上可以利用本地 AI 来发挥 opencode 的优势。

Steps download opencode for terminal at Opencode Website This next step is not numbered due to the length: Next you will want to download a local model like qwen 2.5 coder with a preferrable download filetype being a .llamafile, However 7B isnt always accessible, it depends on your ram: If you have 8 GB of ram(Like the macbook neo) a good to the thumb are in the 3B to 4B range. 12-16 GB of ram(A macbook air or pro) should have a model in the 7B to 8B range 32 GB of ram(The 2013 trashcan mac pro with 4 8 GB sticks or 2 16 GB sticks) is optimal for a model in 7 to 27B models using 4-bit quantization or more. 64 GB of ram(A highly efficient computer) the optimal is 27-35B If you have 128 GB or more RAM the optimal is 35B+

步骤 在 Opencode 网站下载用于终端的 opencode。接下来的步骤因篇幅较长未编号:接下来你需要下载一个本地模型,例如 qwen 2.5 coder,推荐的下载文件类型为 .llamafile。然而,7B 模型并不总是可用的,这取决于你的内存:如果你有 8GB 内存(如 Macbook Neo),经验法则是选择 3B 到 4B 范围的模型。12-16GB 内存(Macbook Air 或 Pro)应选择 7B 到 8B 范围的模型。32GB 内存(2013 款“垃圾桶”Mac Pro,配备 4 根 8GB 或 2 根 16GB 内存条)最适合使用 4-bit 量化或更高精度的 7B 到 27B 模型。64GB 内存(高效能计算机)的最佳选择是 27-35B。如果你有 128GB 或更多内存,最佳选择是 35B 以上的模型。

Booting the AI Download Visual Studio Code at Microsoft Visual Studio code 1A. You can also instead download Visual Studio Codium at Visual Studio Codium Open your terminal and run code ~/.config/opencode/opencode.json 2A. If you are using codium run codium ~/.config/opencode/opencode.json Add your model into the .json an example is { “provider”: { “local-llamafile”: { “npm”: “@ai-sdk/openai-compatible”, “name”: “Local Llamafile Server”, “options”: { “baseURL”: “http://localhost:8080/v1”, “apiKey”: “not-needed” }, “models”: { “qwen2.5-coder-14b”: { “name”: “Qwen 2.5 Coder 7B”, “limit”: { “context”: 32768, “output”: 4096 } } } } }, “model”: “local-llamafile/qwen2.5-coder-7b”, “small_model”: “local-llamafile/qwen2.5-coder-7b”, } Hook your MCP server to opencode via “mcp”: { “servers”: { “mcp-name”: { “type”: “PLACEHOLDER”, “command”: [“/path-to-mcp”] } } } Check if opencode has your model with opencode models if that fails run opencode models —standalone Once you find your model run opencode in your terminal to open the interface If your model is not selected in opencode type in the interface /models to switch. Give it a prompt(MAKE SURE OPENCODE IS RUNNING ON THE SAME PORT THE SERVER IS RUNNING ON)

启动 AI 在 Microsoft Visual Studio Code 网站下载 Visual Studio Code 1A。你也可以选择在 Visual Studio Codium 网站下载 Visual Studio Codium。打开终端并运行 code ~/.config/opencode/opencode.json 2A。如果你使用的是 codium,请运行 codium ~/.config/opencode/opencode.json。将你的模型添加到 .json 文件中,示例如下:{ “provider”: { “local-llamafile”: { “npm”: “@ai-sdk/openai-compatible”, “name”: “Local Llamafile Server”, “options”: { “baseURL”: “http://localhost:8080/v1”, “apiKey”: “not-needed” }, “models”: { “qwen2.5-coder-14b”: { “name”: “Qwen 2.5 Coder 7B”, “limit”: { “context”: 32768, “output”: 4096 } } } } }, “model”: “local-llamafile/qwen2.5-coder-7b”, “small_model”: “local-llamafile/qwen2.5-coder-7b”, }。通过 "mcp": { "servers": { "mcp-name": { "type": "PLACEHOLDER", "command": ["/path-to-mcp"] } } } 将你的 MCP 服务器连接到 opencode。使用 opencode models 检查 opencode 是否包含你的模型,如果失败,请运行 opencode models --standalone。找到模型后,在终端运行 opencode 以打开界面。如果 opencode 中未选中你的模型,请在界面中输入 /models 进行切换。输入提示词(确保 OPENCODE 与服务器运行在相同的端口上)。

Error Handling You may encounter errors when running it in opencode, A common one is ECONNREFUSED. Check if your opencode port matches the one your server is running on otherwise it will throw an ECONNREFUSED and rmeember to doublecheck if you downloaded the html instead of the actual AI brain.

错误处理 在 opencode 中运行时,你可能会遇到错误,常见的一个是 ECONNREFUSED。检查你的 opencode 端口是否与服务器运行的端口匹配,否则会抛出 ECONNREFUSED 错误。并记得仔细检查你下载的是否是 HTML 文件,而不是真正的 AI 大脑文件。

Comparison lemonade.gg gives you 4 free prompts than 20/mo for 100 prompts. forgegui has 4 different plans each one cositng more but gives more credits. zeroscript does not work when you are banned from an Ai service and it iwll most likely get you banned from the AI service you use. Local AI has none of that.

对比 lemonade.gg 提供 4 次免费提示,之后每月 20 美元可获得 100 次提示。forgegui 有 4 种不同的方案,每种方案价格更高但提供更多积分。当你被 AI 服务封禁时,zeroscript 无法工作,而且它很可能会导致你被所使用的 AI 服务封禁。本地 AI 则完全没有这些问题。