[FEATURE]: Include resolved defaultModel in GET /config response #9394

Open
opened 2026-02-16 18:12:20 -05:00 by yindo · 1 comment
Owner

Originally created by @olosegres on GitHub (Feb 15, 2026).

Originally assigned to: @thdxr on GitHub.

I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

When running OpenCode in headless/server mode (opencode serve), external clients connecting via HTTP API have no way to know which model will be used until the first response arrives via SSE.

Current behavior:

  • GET /config returns config info but not the resolved default model
  • Client must send a prompt and wait for message.updated SSE event to see modelID/providerID

Proposed change:

  • Add defaultModel: { providerID: string, modelID: string } to GET /config response
  • Use existing Provider.defaultModel() to resolve it (checks config → recent models → fallback)

Benefits:

  • Headless clients can display "Using model: X" immediately on session start
  • Useful for dashboards, bots, and other integrations that show status before first prompt
  • No breaking changes — adds an optional field to existing response

Implementation:
Already implemented in my fork, happy to open a PR if approved. The change is ~15 lines in packages/opencode/src/server/routes/config.ts.

Originally created by @olosegres on GitHub (Feb 15, 2026). Originally assigned to: @thdxr on GitHub. **I have verified this feature I'm about to request hasn't been suggested before.** ## Describe the enhancement you want to request When running OpenCode in headless/server mode (`opencode serve`), external clients connecting via HTTP API have no way to know which model will be used until the first response arrives via SSE. **Current behavior:** - `GET /config` returns config info but not the resolved default model - Client must send a prompt and wait for `message.updated` SSE event to see `modelID`/`providerID` **Proposed change:** - Add `defaultModel: { providerID: string, modelID: string }` to `GET /config` response - Use existing `Provider.defaultModel()` to resolve it (checks config → recent models → fallback) **Benefits:** - Headless clients can display "Using model: X" immediately on session start - Useful for dashboards, bots, and other integrations that show status before first prompt - No breaking changes — adds an optional field to existing response **Implementation:** Already implemented in my fork, happy to open a PR if approved. The change is ~15 lines in `packages/opencode/src/server/routes/config.ts`.
Author
Owner

@github-actions[bot] commented on GitHub (Feb 15, 2026):

This issue might be related to several existing issues around model resolution in server mode:

  • #12065: opencode serve ignores model config and tries invalid model combination
  • #7099: Server API ignores agent's configured model when only agent parameter is passed
  • #6928: Subtask commands do not inherit model

Your proposed change to include defaultModel in the GET /config response would help expose and clarify the current model resolution behavior, which is a good step toward addressing these related issues.

@github-actions[bot] commented on GitHub (Feb 15, 2026): This issue might be related to several existing issues around model resolution in server mode: - #12065: `opencode serve` ignores model config and tries invalid model combination - #7099: Server API ignores agent's configured model when only agent parameter is passed - #6928: Subtask commands do not inherit model Your proposed change to include `defaultModel` in the `GET /config` response would help expose and clarify the current model resolution behavior, which is a good step toward addressing these related issues.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#9394