Model configuration
Codant uses a model alias to select a provider, wire protocol, and model ID. Configure a model in the setup wizard, then run a fixed-input check against your provider.
Configure your first model
Enter /model setup in Codant's terminal UI, or run codant model setup from an interactive terminal. Follow the wizard to choose a provider, enter credentials where required, and choose a model from the catalog or enter its exact ID. Press Ctrl+L in the wizard to switch between Chinese and English. Run codant model providers to see provider presets, protocols, and credential environment variable names.
Choose Run the connection checks. Once the checks pass, set the model alias and decide whether to make it the global default. If you entered a new credential, choose where to store it. Select Save the tested configuration and review the result. Wizard options · Check and save logic
With the local model service and the Codant daemon running, use codant model discover ollama or codant model discover lmstudio from another terminal to read its catalog. Discovered aliases are available for selection. A catalog result shows what the current connection can see. Check actual conversational capability with a model test. Model commands in runModelCommand · Wizard controls
Configuration paths and model selection
The user model configuration defaults to ~/.codant/config.toml. Set CODANT_DATA_DIR to move the default config.toml to that directory. An explicit CODANT_CONFIG_FILE takes precedence over either default path. Define providers, model aliases, and default_model in this user file. A project's codant.toml can point a caste to a user-defined alias under [castes], for example worker = "my-model". See configFilePath, loadUserConfig, and loadProjectConfig in packages/core/src/model/config.ts.
| Command | Scope |
|---|---|
codant model use <alias> | Save the user's default model. The alias must exist in [models]. |
/model or /model <alias> in the terminal UI | Open the model panel to select and confirm a model for the current session. |
/model --inherit in the terminal UI | Open the session's inherit option. Upon confirmation, Codant checks the project's worker mapping first, then the user's default. |
codant exec --model <alias> "prompt" | Select the model for one non-interactive run. |
A terminal session uses its applied selection first, then [castes].worker in the session workspace's codant.toml, then the user's default_model. For codant exec, the order is --model, [castes].worker in the command's working directory, then default_model. See SessionModelSelections.target in packages/core/src/ant/session-model-selection.ts and ExecRuntime in packages/api/src/exec-runtime.ts.
Run codant model list to check the aliases, providers and model IDs, protocols, and credential sources that the current CLI resolves offline. An asterisk marks the user's default. To check the actual choice for a terminal session, open /model and read the current alias, its source, and the daemon's selection receipt. If the receipt is unconfirmed, press r in the original session to look up the same selection. See listModelsLocal in packages/api/src/model.ts, modelOverlay in packages/cli/src/tui/model-view.ts, and model-browser.ts in the same directory.
Configure a compatible endpoint
For an OpenAI Chat Completions-compatible endpoint, declare the provider and model in the user configuration. Replace the example endpoint, model ID, and variable name with the values for your service. Make credentials available to the daemon through a trusted environment.
[providers.my-vendor]
type = "openai-chat-completions"
base_url = "https://api.example.com/v1"
api_key_env = "MY_VENDOR_KEY"
[models.my-model]
provider = "my-vendor"
model = "actual-model-id"
origin = "manual"The provider table defines the protocol and base URL. In the model table, my-model is Codant's alias and model is the ID recognized by the provider. After updating the configuration, run the fixed-input check below against the alias. Provider and model configuration schemas
Manage credentials
For providers that use credentials, Codant first checks the configured environment variable, then looks for a key or a system keyring marker in the local auth.toml. The default path is ~/.codant/auth.toml. Set CODANT_AUTH_FILE to choose a path. Keys stored in this file are plaintext. Restrict access to the credential file and any backups that may contain old values.
codant model login <provider> --keyring uses the system keyring and masks the key during interactive entry. When you explicitly select the keyring, an unavailable keyring produces an error. Use codant model logout <provider> to manage saved provider credentials. Keep live keys in a trusted environment or credential store, away from model prompts, command arguments, and project configuration. Credential resolution in CredentialManager.resolve · Login and logout arguments · Credential fields in credentialSection
Verify the model connection
The running Codant daemon performs discovery and tests using its own configuration, environment, and credentials. If you changed environment variables in a new terminal, let active work finish, then start the daemon from a terminal with the intended environment before running the check.
codant model list
codant model test my-modelReplace my-model with a configured alias. The test uses fixed inputs and reports pass, fail, or timeout for plain replies, streaming, tool calls, and JSON mode. For a failed check, examine the specific result and confirm the endpoint, model ID, credentials, and relevant model capability. Discovery and test commands · Capability checks in runSmoke
Use image input
codant model capabilities my-model shows the declared image capability. Once you have confirmed that the provider offers image input for that model, update the declaration with codant model capabilities my-model --vision on and run codant model test my-model --vision. This test sends a fixed built-in image. The result applies to the configuration and account used for that run. Capability declaration command · Vision check implementation
Quickstart · Daemon and model troubleshooting · Guide overview
