Skip to content

model_id/provider_id sent as flat fields instead of nested model object #52

Description

@raywcm

Summary

The Python SDK sends modelID/providerID as flat top-level fields in request bodies, but the OpenCode server expects them nested inside a model object.

Affected endpoints

  • session.chat() (sync and async)
  • session.init() (sync and async)

Expected behavior

The SDK should nest model selection parameters:

{ "model": { "providerID": "anthropic", "modelID": "claude-opus-4-5-20251101" }, ... }

Actual behavior

{ "modelID": "claude-opus-4-5-20251101", "providerID": "anthropic", ... }

Fix

  • Added ModelParam TypedDict to session_chat_params.py
  • Updated SessionChatParams and SessionInitParams to use nested model: ModelParam
  • Updated all 4 body constructions in session.py (sync/async chat, sync/async init)

Metadata

Metadata

Assignees

No one assigned

    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