support glm-5-2 on opencode #186
Merged
Merged
Conversation
discover_model_services bucketed OSS models with an allowlist ("kimi-"
only), so GLM/Llama/Qwen/DeepSeek and any future OSS family were
discovered from UC model-services but dropped on the floor — never
reaching opencode_models, so they couldn't be listed or selected in
OpenCode (e.g. system.ai.glm-5-2).
Bucket OSS by exclusion instead: anything not claude/gpt/gemini, minus
non-chat model services (embeddings, rerankers) that can't back a chat
agent. New OSS families now surface without a code change.
Co-authored-by: Isaac
…ents
The Databricks gateway caps GLM's max output (completion) tokens and
rejects requests above it. These limits are a property of the model +
its /ai-gateway/mlflow/v1 route, not of any one agent, so expose them as
a single model_token_limits() helper (family->limits table) in
databricks.py. Each agent translates the limits into its own config
dialect.
OpenCode's per-model schema is strict (`additionalProperties: false`)
and its `limit` object requires BOTH context and output — supplying only
output made the whole opencode.json invalid ("Configuration is
invalid"). The table now always provides both fields, so OpenCode pins
`limit: {context, output}` and clamps `max_tokens` to a gateway-accepted
value. Adding a model/limit is a one-line edit shared across
opencode/pi/copilot.
Co-authored-by: Isaac
The previous catch-all bucketed any non-claude/gpt/gemini model (llama,
qwen, deepseek, ...) into OSS, offering families we haven't validated.
Go back to an explicit allowlist, but include both kimi and glm.
_OSS_MODEL_FAMILIES = ("kimi-", "glm-") replaces the exclusion logic and
its non-chat marker filter (embeddings/rerankers never match the
allowlist, so no filtering is needed).
Co-authored-by: Isaac
Under the kimi/glm allowlist, llama-4-maverick again matches no family, so the original test (asserting it's reported in the "no families" reason) holds without the embedding-service substitute. Co-authored-by: Isaac
Co-authored-by: Isaac
rohita5l
approved these changes
Jul 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1/ support kimi and glm. i use a hardcoded list instead of just fetching all oss models because not all of them work (ie qwen fails with some error about ints). i confirmed kimi and glm work
2/ cap glm at an output token limit of 25k. otherwise it will fail. we see the same issue in the browser if we don't cap the output token limit.