GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(ai): move endpoint support flags to model capabilities by rekram1-node · Pull Request #61492 · anomalyco/opencode

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Nov 3, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

First PR in the @opencode/ai model redesign: the package Model mirrors models.dev v2 ModelV2 with one API resolved and camelCase names (id, provider, type, api, baseURL, modalities, capabilities, limit, compatibility, cost, plus package-only auth and options). Targets dev (#60971, flat generation knobs, is merged). This step adds capabilities in the v2 shape and moves the "does the endpoint accept X" flags off compatibility into it.

Problem

LanguageModel.compatibility mixed two kinds of things:

  • wire quirks: which field holds reasoning, max_tokens vs max_completion_tokens, cache marker syntax
  • support facts: does this endpoint accept store, stream_options.include_usage, prompt_cache_key, strict on tools, per-message effort updates, mid-conversation system messages

models.dev v2 publishes the second kind as capabilities, under other names. The package had no capabilities at all and guessed some of them from the model ID.

Change

capabilities is models.dev v2 CapabilitiesV2 in camelCase, all fields optional (unset keeps today's protocol default):

capabilities: {
  tools?: { supported, strict, choice, search, freeform, updates }
  reasoning?: { supported, default, toggle, effort, budget, updates }   // effort updates live here, not top-level
  cache?, structuredOutput?, temperature?, topP?, topK?,
  systemUpdates?, store?, streamUsage?, promptCacheKey?, serviceTier?
}
Before (compatibility) After (capabilities)
supportsStore store
streamUsage streamUsage
supportsStrictMode tools.strict
supportsPromptCacheKey promptCacheKey
supportsEffortUpdates reasoning.updates
(model-ID check only) systemUpdates
 OpenAIChat.route.with({ endpoint: { baseURL } }).model({
   id: "kimi-k2.6",
-  compatibility: { maxTokensField: "max_tokens", supportsStrictMode: false, supportsPromptCacheKey: true },
+  compatibility: { maxTokensField: "max_tokens" },
+  capabilities: { tools: { strict: false }, promptCacheKey: true },
 })

Protocols read these fields first and keep today's guessing only as the fallback when a field is unset: provider/URL detection for store and tools.strict (OpenAI Chat), model-ID detection for reasoning.updates (OpenAI Responses, Anthropic Messages, Bedrock Mantle) and for systemUpdates (Anthropic Messages). The 22 provider call sites and the three shared constants (AlibabaChat, ZAIChat, VeniceChat) are updated. The other fields (cache, tools.updates, serviceTier, ...) are carried for callers and not read yet. No aliases for the old names.

Core

OpenCode config keeps its compatibility keys (supportsPromptCacheKey, streamUsage, supportsEffortUpdates); they are a public config contract. ModelResolver maps them onto the runtime model's capabilities (promptCacheKey, streamUsage, reasoning.updates) with the same precedence as before (config over package default). That is the only core source change, in model-resolver.ts; it renames keys, it doesn't add behavior. Core does not pass catalog capabilities it dropped before. No plugin, SDK, server or config types change. aisdk.ts is untouched: AI SDK models never read these flags.

Checked locally: 36 sample models byte-identical (method, URL, headers, body vs a snapshot taken before the redesign, including each config compatibility key); full catalog 8544 models, 0 requests differ (7732 send a request; the rest are AI SDK packages or need real cloud config). Both checks resolve models through ModelResolver and capture the exact request the AI package sends. They stay out of the repo.

Out of scope

  • limit, modalities, unified compatibility and cost (later PRs in this stack).
  • Moving the provider/URL and model-ID guessing out of protocols.

Size

src +148 / -51 (the v2 Capabilities type, protocol reads, the core key mapping), tests +22 / -23.

Verification

  • bun typecheck and bun run typecheck:tsc in packages/ai, core, server, sdk, plugin: pass
  • bun test in packages/ai: 2046 pass, 0 fail (all cassettes replay unchanged)
  • packages/core: model-resolver, config/provider, session-runner-recorded, plugin/: 644 pass
  • Local wire checks: 36 sample models byte-identical; full catalog 8544 models, 0 requests differ
  • bun run check: pass

Added by the opencode bot (AI-generated).

Related: #52617

Public API: @opencode/ai: five LanguageModelCompatibility support flags move to the new LanguageModel.capabilities (supportsEffortUpdates → capabilities.reasoning.updates; adds systemUpdates); breaking for direct @opencode/ai callers, OpenCode config/SDK/server/plugin APIs unchanged

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot added the contributor label Nov 3, 2026
opencodejr[bot]
opencodejr Bot reviewed Nov 3, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The refactor holds up. I checked the snapshot against the base: copied into the pr/base worktree, model-wire.test.ts passes there unchanged, so the 36 sample models send the same requests before and after. The AI package tests (2045 pass) and the listed core tests (112 pass) pass, and typecheck:tsc passes in ai and core.

Public API: OpenCode's config schema, SDK, server and plugin types don't change. The published @opencode/ai package has a breaking type change:

  • LanguageModelCompatibility loses supportsStore, streamUsage, supportsStrictMode, supportsPromptCacheKey and supportsEffortUpdates.
  • LanguageModel gains capabilities (store, streamUsage, promptCacheKey, effortUpdates, tools.strict), and a new ModelCapabilities type is exported.

Direct callers of @opencode/ai that pass the old keys in .model({ compatibility }) will fail type-checking; in untyped JS, those keys are now silently ignored. As stated in the description, there are no aliases. Worth a changelog note when this ships.

No blocking concerns.

Related: #52617

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node rekram1-node mentioned this pull request Nov 3, 2026
refactor(ai): replace model and route defaults with model options #61494
Merged
@rekram1-node
rekram1-node force-pushed the model-capabilities branch from f6b63d8 to 2178d0a Compare November 3, 2026 21:25
@rekram1-node
rekram1-node changed the base branch from dev to request-generation November 3, 2026 21:25
opencodejr[bot]
opencodejr Bot reviewed Nov 3, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commit is the same change rebased onto request-generation. Its only edits switch to that branch's flat maxTokens and temperature fields; the capabilities move is unchanged. I re-checked it against the new base: copied there, the wire snapshot test passes unchanged. packages/ai tests (2046 pass), the listed core tests (112 pass) and typecheck:tsc in ai and core all pass.

The packages/stats and services/www changes in the diff come from a dev commit (#61459) that isn't on request-generation yet. They should drop out once the PR is retargeted.

Public API impact is the same as in my last review: a breaking type change for direct @opencode/ai callers (LanguageModelCompatibility.supports* and streamUsage → LanguageModel.capabilities). OpenCode config, SDK, server and plugin APIs don't change. No new concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node rekram1-node mentioned this pull request Nov 3, 2026
refactor(ai): make Model one plain object for every model type #61499
Open
@rekram1-node
rekram1-node force-pushed the model-capabilities branch from 2178d0a to 42ca2bc Compare November 3, 2026 21:45
opencodejr[bot]
opencodejr Bot reviewed Nov 3, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new push is the same commit (git range-diff reports it as identical), now placed directly on request-generation. The unrelated packages/stats and services/www changes from #61459 are no longer in the diff. The wire snapshot and model-resolver tests still pass. Public API impact is unchanged from my last review. No new concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node rekram1-node mentioned this pull request Nov 3, 2026
feat(ai): describe text models by api, baseURL and auth #61501
Closed
@rekram1-node
rekram1-node force-pushed the model-capabilities branch from 42ca2bc to 88a666e Compare November 4, 2026 00:02
opencodejr[bot]
opencodejr Bot reviewed Nov 4, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This push only removes model-wire.test.ts and its snapshot; the source is the same as what I reviewed before. The remaining core tests still pass. Before it was removed, I ran the wire snapshot on both the base and the PR head and the requests were identical. Public API impact is unchanged from my last review. No new concerns.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-actions github-actions Bot mentioned this pull request Nov 4, 2026
📊 AI CLI 工具社区动态日报 2026-11-04 litang9/big_model_radar#650
Open
@rekram1-node
rekram1-node force-pushed the model-capabilities branch from 88a666e to f4c105a Compare November 4, 2026 17:21
opencodejr[bot]
opencodejr Bot reviewed Nov 4, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new push still sends the same requests: I restored the removed 36-model wire snapshot locally on this head and it passes unchanged. packages/ai tests (2046 pass), the listed core tests (111 pass) and typecheck:tsc in ai and core all pass. The core supportsEffortUpdates → reasoning.updates mapping keeps any other reasoning values on the base model.

Public API (@opencode/ai, breaking for direct callers): LanguageModelCompatibility loses supportsStore, streamUsage, supportsStrictMode, supportsPromptCacheKey and supportsEffortUpdates. LanguageModel gains capabilities: Capabilities: supportsEffortUpdates becomes capabilities.reasoning.updates (the description's table still says effortUpdates), and there is a new systemUpdates override. OpenCode config, SDK, server and plugin APIs don't change.

One concern, inline: most of the newly declared Capabilities fields aren't read anywhere, so setting them has no effect.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/ai/src/schema/options.ts
* What the model accepts on its API: models.dev v2 `capabilities` in camelCase, with the API's own overrides merged in.
* Unset fields keep the protocol default, which may still guess from the provider, base URL or model ID.
*/
export interface Capabilities {

@opencodejr opencodejr Bot Nov 4, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only store, streamUsage, promptCacheKey, tools.strict, reasoning.updates and systemUpdates are read anywhere. Nothing reads tools.supported/choice/search/freeform/updates, reasoning.supported/default/toggle/effort/budget, cache, structuredOutput, temperature, topP, topK or serviceTier, and core never fills them. On a published type, a caller setting e.g. temperature: false or cache: false would get no error and no effect. Could this PR declare only the fields that are read, and add the rest when a later PR in the series reads them? If they need to stay, mark them as informational, not enforced.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@rekram1-node rekram1-node Nov 4, 2026

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional: the type mirrors models.dev v2 CapabilitiesV2 so a catalog entry maps onto the model 1:1. Only the fields that replace an existing flag or guess are read in this PR, so requests stay byte-identical; the rest are carried for callers and listed as not read yet in the description.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

opencodejr[bot] reacted with eyes emoji
All reactions
  • 👀 1 reaction

@opencodejr opencodejr Bot Nov 4, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That works. Mirroring CapabilitiesV2 1:1 is a good reason to keep the whole shape. Only the six fields that replace a flag or a guess are read, so the request stays byte-identical, and later PRs in the stack can start reading the other fields without changing the type.

One small gap: the "not read yet" note is only in the PR description. Someone using the published type won't see it, and setting temperature: false or cache: false will silently do nothing. A one-line addition to the interface doc in packages/ai/src/schema/options.ts (~L217) would close that:

/**
 * What the model accepts on its API: models.dev v2 `capabilities` in camelCase, with the API's own overrides merged in.
 * Unset fields keep the protocol default, which may still guess from the provider, base URL or model ID.
 * Protocols currently read only `store`, `streamUsage`, `promptCacheKey`, `systemUpdates`, `tools.strict`
 * and `reasoning.updates`; the other fields are informational and not enforced yet.
 */

That's optional, and fine to leave out if the next PRs will read these fields soon. I made no changes in the checkout.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Base automatically changed from request-generation to dev November 4, 2026 22:31
@rekram1-node
rekram1-node force-pushed the model-capabilities branch from f4c105a to a9e4b73 Compare November 4, 2026 22:43
opencodejr[bot]
opencodejr Bot reviewed Nov 4, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This push only rebases the same commit onto dev; the patch is identical. Tests in ai and core and typecheck:tsc still pass, and the 36-model wire snapshot still matches when I restored it locally. The open point about declared-but-unread Capabilities fields still applies to the code. The description now explains it, but the type itself doesn't say those fields aren't enforced. Public API impact is unchanged from my last review. Nothing new.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rekram1-node
refactor(ai): move endpoint support flags to model capabilities
2b3d0b5
@rekram1-node
rekram1-node force-pushed the model-capabilities branch from a9e4b73 to 2b3d0b5 Compare November 4, 2026 23:37
opencodejr[bot]
opencodejr Bot reviewed Nov 4, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This push only rebases the same commit onto a newer dev; the patch is identical. Tests in ai and core and typecheck:tsc still pass. Public API impact is unchanged from my last review. Nothing new.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
This was referenced Nov 4, 2026
"tools" entry sent to model without tools capability #61843
Closed
[FEATURE]: Forward promptCacheKey to GitHub Copilot GPT (Responses) requests #61936
Closed
@rekram1-node
rekram1-node merged commit e90f8d4 into dev Nov 5, 2026
36 of 37 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@rekram1-node
rekram1-node deleted the model-capabilities branch November 5, 2026 15:23
@Asahi-Prv Asahi-Prv mentioned this pull request Nov 8, 2026
fix(ai): recover DeepSeek DSML tool calls leaked into message text #60575
Open
3 tasks done
@rekram1-node rekram1-node mentioned this pull request Nov 27, 2026
fix(core): read effort and system update flags from models.dev #66717
Merged
3 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

contributor

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@rekram1-node
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.