Gets or creates a client from the codebase search tool config and verifies the model is available.
Uses the tool config system (not the usage map). Ensures tool config exists, applies CLI model override if provided, verifies the model is available on the server, but doesn't save config until after all checks are complete.
`opt_url` and `opt_api_key` only affect defaults if config is not already loaded. If config is loaded, they are ignored and existing defaults are used.
| model_type |
"embed" for embed model, "analysis" for analysis model |
| opt_url |
Optional URL from command line (required if config not loaded; creates default connection if provided) |
| opt_api_key |
Optional API key from command line (only used if config not loaded) |
| cli_model_override |
Optional model name override from command line (overrides the model in tool config) |
|
Client instance for the model |
| Error |
if client cannot be created or model is not available |