← All guides

How to use other models (GLM, DeepSeek, local) in a coding agent

If you'd rather run your coding agent on GLM, DeepSeek, an OpenAI-compatible endpoint, or a local model — for cost, speed, or availability — here's how model routing actually works and what to check before you switch.

TL;DR: A coding agent is just a model plus a tool-execution loop. If the client speaks the OpenAI-compatible API, you can point it at GLM, DeepSeek, a self-hosted vLLM endpoint, or anything else that exposes that API — set the base URL, key, and model name. Agents locked to a single provider can't do this; ones built to bring your own model can.

Why swap the model at all

Cost

GLM and DeepSeek can be dramatically cheaper per token for everyday coding work.

Availability

When one provider is capped, rate-limited, or down, a second model keeps you moving.

Privacy / control

A local or self-hosted model keeps code on your own machine or network.

How model routing works

Under the hood, a coding agent sends chat-completion requests to a model endpoint and runs the tool calls it gets back. If two providers speak the same API shape — and most speak the OpenAI-compatible one — swapping between them is just changing three things: the base URL, the API key, and the model name. The agent loop doesn't care which model is behind the endpoint.

What you typically set

FieldExampleNotes
Base URLhttps://…/v1The provider's OpenAI-compatible endpoint
API keyyour own keyBilled to you as usage
Model nameglm-4.7 / deepseek-chat / your local modelWhatever that endpoint exposes

The catch: not every client lets you

The blocker is usually the client, not the model. An agent hard-wired to one provider won't let you change the endpoint, so you're stuck on that provider's pricing and limits. To route freely you need a client that's built to bring your own model — where the provider, base URL, and key are settings, not fixed.

The rule of thumb: if a client exposes 'base URL + key + model' as settings, you can point it at almost any OpenAI-compatible provider (GLM, DeepSeek, Together, a local vLLM, and so on).

Running a local model

For a fully local setup, serve a model with something that exposes an OpenAI-compatible API (for example vLLM), then point the agent's base URL at your local server. Now your code never leaves your machine and there's no per-token bill at all — you trade that for needing the hardware to run the model.

FAQ

Can I use GLM or DeepSeek instead of the default model?

Yes, if your client lets you set the base URL, key, and model name. Both GLM and DeepSeek expose OpenAI-compatible endpoints, so a client that supports custom providers can route to them directly.

Can a coding agent run a local model?

Yes — serve the model with an OpenAI-compatible server (like vLLM) and point the agent's base URL at your local endpoint. Your code stays on your machine and there's no per-token cost.

Why can't I change the model in my current agent?

Because it's hard-wired to one provider. To switch freely you need a client where the provider, base URL, and key are configurable settings rather than fixed values.

Want to run your coding agent on GLM, DeepSeek, an OpenAI-compatible endpoint, or a local model — and switch whenever you like? Wuwei is a free, open-source AI agent built to bring your own model: set the provider, base URL, and key, and route wherever you want.

Windows · macOS · Linux — free, no login