SwitchTo switches the session to a model and optional reasoning configuration. RPC method: session.model.switchTo. Parameters: Target model identifier and optional reasoning effort, summary, capability overrides, and context tier. Returns: The model identifier active on the session after the swit
(ctx context.Context, params *ModelSwitchToRequest)
| 15363 | // |
| 15364 | // Returns: The model identifier active on the session after the switch. |
| 15365 | func (a *ModelAPI) SwitchTo(ctx context.Context, params *ModelSwitchToRequest) (*ModelSwitchToResult, error) { |
| 15366 | req := map[string]any{"sessionId": a.sessionID} |
| 15367 | if params != nil { |
| 15368 | if params.ContextTier != nil { |
| 15369 | req["contextTier"] = *params.ContextTier |
| 15370 | } |
| 15371 | if params.ModelCapabilities != nil { |
| 15372 | req["modelCapabilities"] = *params.ModelCapabilities |
| 15373 | } |
| 15374 | req["modelId"] = params.ModelID |
| 15375 | if params.ReasoningEffort != nil { |
| 15376 | req["reasoningEffort"] = *params.ReasoningEffort |
| 15377 | } |
| 15378 | if params.ReasoningSummary != nil { |
| 15379 | req["reasoningSummary"] = *params.ReasoningSummary |
| 15380 | } |
| 15381 | } |
| 15382 | raw, err := a.client.Request(ctx, "session.model.switchTo", req) |
| 15383 | if err != nil { |
| 15384 | return nil, err |
| 15385 | } |
| 15386 | var result ModelSwitchToResult |
| 15387 | if err := json.Unmarshal(raw, &result); err != nil { |
| 15388 | return nil, err |
| 15389 | } |
| 15390 | return &result, nil |
| 15391 | } |
| 15392 | |
| 15393 | // Experimental: NameAPI contains experimental APIs that may change or be removed. |
| 15394 | type NameAPI sessionAPI |