Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save minanagehsalalma/52a1bdd5f5d90513f5c3fb2f9abff367 to your computer and use it in GitHub Desktop.

Select an option

Save minanagehsalalma/52a1bdd5f5d90513f5c3fb2f9abff367 to your computer and use it in GitHub Desktop.
GLM-5.1 in OpenCode: practical provider notes

GLM-5.1 in OpenCode

Practical provider notes from a real working setup
Date: 2026-05-06


Quick verdict

GLM-5.1 works in OpenCode today if you wire it in as an additive OpenAI-compatible provider instead of trying to replace your existing default stack.

Validated working routes:

  • glm-nvidia/glm-5.1
  • glm-puter/glm-5.1

Conditionally useful:

  • local gateway route, but only when the local service is actually online

Why this setup works

The clean pattern is simple:

  1. Leave your main OpenCode default model alone.
  2. Add GLM-5.1 as extra providers.
  3. Keep a separate fast fallback model for background or title-style work.
  4. Surface local gateways only when they are reachable.

That gives you GLM without turning the rest of the setup brittle.


Working provider routes

NVIDIA NIM

Route

  • OpenCode model: glm-nvidia/glm-5.1
  • Provider style: OpenAI-compatible
  • Upstream model ID: z-ai/glm-5.1

Result

  • working

Verification

  • direct completion call succeeded
  • opencode run -m glm-nvidia/glm-5.1 ... returned a valid response

Puter

Route

  • OpenCode model: glm-puter/glm-5.1
  • Provider style: OpenAI-compatible
  • Upstream model ID: z-ai/glm-5.1

Result

  • working

Verification

  • direct completion call succeeded
  • opencode run -m glm-puter/glm-5.1 ... returned a valid response

Caveat

  • this path may rely on session-style auth, so it is convenient but less durable than a standard API-key provider

Local gateway note

A local gateway is still worth keeping around, but it should behave like a live system status, not a fake permanent option:

  • if the service is listening, show it as available
  • if the service is down, hide it or mark it clearly offline

That keeps the model picker honest and avoids dead choices in the UI.


Recommended OpenCode shape

If you want this to feel stable in daily use:

  • keep the main reasoning/default path on your existing Google or Antigravity stack
  • expose GLM as extra working models, not a forced replacement
  • prefer stable remote GLM providers first
  • keep a fast fallback model for background work and metadata generation

In practice, additive integration is the difference between a flexible setup and a fragile one.


Public-safe sharing checklist

Safe to publish:

  • provider pattern
  • model IDs
  • high-level status notes
  • fallback strategy
  • UI and routing behavior

Do not publish:

  • local absolute filesystem paths
  • account emails
  • bearer tokens
  • refresh tokens
  • session cookies
  • API keys
  • private repository remotes

Bottom line

GLM-5.1 is usable in OpenCode right now through OpenAI-compatible providers, and the safest pattern is to layer it on top of your existing setup rather than swap the whole stack around it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment