Run OpenClaw on your VPS with free AI tokens
Point OpenClaw at the free AI tokens of your server with one custom provider in openclaw.json. OpenAI-compatible API, no API bill.
OpenClaw can use any OpenAI-compatible API as a model provider. Here is how to point it at the free AI tokens of your Starcloud server.
Before you start
- OpenClaw is installed on your Starcloud server, or on one of the IP addresses you added to the key on the AI tab. Calls from anywhere else are refused.
- The first invoice of the server is paid. Servers on a free trial have no key yet.
- Open Servers, choose your server and open the AI tab. Keep the base URL, the API key and the list of models at hand.
1. Keep the key out of the config file
Add the key to the environment of the user that runs OpenClaw, for example at the end of ~/.profile:
export STARCLOUD_AI_KEY="paste-the-key-from-the-ai-tab"
Then sign out and back in, or run source ~/.profile. If OpenClaw runs as a service, set the variable in the environment of that service instead.
2. Add Starcloud as a provider
Open ~/.openclaw/openclaw.json and add a provider under models.providers, then make it the default model. Replace MODEL_ID with a model id from the AI tab, written exactly as shown there:
{
agents: {
defaults: {
model: { primary: "starcloud/MODEL_ID" },
},
},
models: {
mode: "merge",
providers: {
starcloud: {
baseUrl: "paste-the-base-url-from-the-ai-tab",
apiKey: "${STARCLOUD_AI_KEY}",
api: "openai-completions",
models: [
{
id: "MODEL_ID",
name: "Starcloud AI",
reasoning: false,
input: ["text"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 32000,
maxTokens: 4096,
},
],
},
},
},
}
apistaysopenai-completions: your allowance uses the Chat Completions API.- A small
contextWindowmakes OpenClaw shorten the conversation sooner, so each step uses fewer of your tokens. - When your plan has several models, add one entry per model you want to use.
3. Restart and test
Restart OpenClaw (or its gateway service) so it reads the new configuration, then send it a short message.
How far do the tokens go?
An agent sends its instructions, the list of its tools and the conversation with every step. One task can take several thousand tokens. Your plan gives the key one pool of tokens per period (for example a day), shared across its models; some models can count for more than one token per token. The AI tab shows the pool, the period and what is left. When the pool runs out, OpenClaw shows an error until the next period starts. You can also add your own provider key in OpenClaw as a fallback.
Troubleshooting
- 403
ip_not_allowed: OpenClaw does not run on the server the key belongs to or on an address you added, or its traffic leaves through another address (a proxy or a VPN). - 403
model_not_allowed: the model id is not part of your plan. Use one from the AI tab. - 429
quota_exceeded: the pool for this period is used up. It comes back at the time in thex-starcloud-resetheader, also shown on the AI tab. - 429
rate_limit_exceeded: too many tokens or requests in one minute. Wait a minute. - 401: the key is wrong or was regenerated. Copy it again from the AI tab and check that
STARCLOUD_AI_KEYis set for the user or service that runs OpenClaw.