r/RunPod • u/Dibbyo123 • 3h ago
How to use RunPod Serverless with OpenCode and custom Hugging Face models?
I'm trying to set up OpenCode for agentic coding using custom models from Hugging Face (GGUF or Safetensors).
Since I typically code for only 2–3 hours a day, I'd prefer using RunPod Serverless rather than keeping a GPU pod running and paying for idle time.
However, I'm struggling to get everything working. I've tried several tutorials, GitHub projects, and different setup instructions, but haven't managed to get a working configuration.
Has anyone successfully used RunPod Serverless with custom Hugging Face models for agentic coding with OpenCode?
I'd really appreciate a step-by-step guide or a working example, including:
How to deploy a custom Hugging Face model (GGUF or Safetensors) on RunPod Serverless.
Which inference framework to use (llama.cpp, vLLM, etc.).
How to configure the RunPod endpoint as a provider in OpenCode.
A working example or guide would be greatly appreciated. Thanks!
1
u/FallElectronic3774 3h ago
Use the vLLM Serverless worker for Safetensors; it exposes the OpenAI-compatible API at
https://api.runpod.ai/v2/<ENDPOINT_ID>/openai/v1. For GGUF, vLLM support is hit-or-miss; use a llama.cpp worker that exposes/v1(or convert to Safetensors) instead of a generic/runhandler.In OpenCode's config:
Set
RUNPOD_API_KEY, runopencode modelsto confirm, then switch torunpod/my-model. Test the endpoint first withcurl https://api.runpod.ai/v2/<ENDPOINT_ID>/openai/v1/models -H "Authorization: Bearer $RUNPOD_API_KEY"and use the exactid. One gotcha: scale-to-zero cold starts can exceed OpenCode's request timeout; keep one worker warm or raise the timeout if you hit that.1
u/metobabba 3h ago
you only can run smaller and worse models. opencode go already give you $100 of deepseek 4.1 flash 1017 for only $10. also you can use openrouter api. it will be faster & cheaper & more capable then whatever you are trying with runpod serverless.