You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add onListModels handler to CopilotClientOptions for BYOK mode (#730)
Add an optional onListModels handler to CopilotClientOptions across all
4 SDKs (Node, Python, Go, .NET). When provided, client.listModels()
calls the handler instead of sending the models.list RPC to the CLI
server. This enables BYOK users to return their provider's available
models in the standard ModelInfo format.
- Handler completely replaces CLI RPC when set (no fallback)
- Results cached identically to CLI path (same locking/thread-safety)
- No connection required when handler is provided
- Supports both sync and async handlers
- 10 new unit tests across all SDKs
- Updated BYOK docs with usage examples in all 4 languages
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/auth/byok.md
+110Lines changed: 110 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -306,6 +306,116 @@ provider: {
306
306
307
307
> **Note:** The `bearerToken` option accepts a **static token string** only. The SDK does not refresh this token automatically. If your token expires, requests will fail and you'll need to create a new session with a fresh token.
308
308
309
+
## Custom Model Listing
310
+
311
+
When using BYOK, the CLI server may not know which models your provider supports. You can supply a custom `onListModels` handler at the client level so that `client.listModels()` returns your provider's models in the standard `ModelInfo` format. This lets downstream consumers discover available models without querying the CLI.
Results are cached after the first call, just like the default behavior. The handler completely replaces the CLI's `models.list` RPC — no fallback to the server occurs.
0 commit comments