Skip to content

AI SDK response model ID is discarded from assistant turns #42420

Description

@KarmCraft

Description

OpenCode's AI SDK adapter receives the provider's normalized response.modelId on every finish-step, but drops it before the assistant turn is persisted. Clients therefore see only the requested alias (provider/auto), not the response model.

Preserve response.modelId as optional step-finish metadata so clients can report the model used for that turn. This does not persist response headers.

Related to #26091, which asks to expose raw response headers. This issue is the narrower structured-model path and blocks pingdotgg/t3code#6536.

Plugins

None

OpenCode version

1.15.13

Steps to reproduce

  1. Configure an OpenAI-compatible provider with an alias such as auto.
  2. Return a different model in the completion stream.
  3. Inspect the assistant message events.
  4. The assistant reports provider/auto; the response model ID is absent.

Screenshot and/or share link

pingdotgg/t3code#6536

Operating System

Windows 11

Terminal

T3 Code / OpenCode SDK

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions