opencode
opencode copied to clipboard
feat: add agent/model/variant pre-select through url parameters
What does this PR do?
This adds a support for agent, model and variant pre-selection through URL parameters in /session endpoint.
This allows better integration with external tools. For example neovim users could bind a keybinding to open new session on a project with Plan agent and specific model pre-selected.
Closes: https://github.com/anomalyco/opencode/issues/6822
For example http://127.0.0.1:62136/QzpcVXNlcnNcYWRtaW5cQ29kZVxvcGVuY29kZS1wbHVnaW4/session?agent=plan will pre-select Plan agent in web UI.
additional URL parameters:
?model= (example ?model=opencode/gpt-5-nano)
?variant= (example ?variant=high)
How did you verify your code works?
I have tested it manually by entering URL in a browser and seeing parameters in the chat box being selected.