Set up the LLM provider that answers questions in the Ask Forge CLI. This page covers when you need one, the llm commands, each provider type and its fields, and how API keys are kept.
By the SchemaSmith Team · Last reviewed
The llm section configures which AI provider powers the conversational mode.
Direct CLI subcommands and MCP tool calls work without any LLM provider. Only conversational mode needs one: the questions you ask in the ask-forge REPL or on its command line.
No provider is active until you set one up. At launch, the REPL says so with LLM: Not configured - type 'llm setup' to configure. Until then, a question gets a short list of commands to run instead, and a question asked on the command line still exits with code 0.
Provider settings live in the llm section of the settings file. The CLI reads them, along with the environment variables below, which override them.
Inside the REPL, the llm commands show, set up, switch, and test LLM providers. Each change is saved to the settings file in use:
| Command | What it does |
|---|---|
llm |
Shows the active provider and its model, and tests the connection. When more than one provider is configured, it also lists all of them and marks any that are invalid. With no provider active, it says so and names the settings file. |
llm setup |
Interactive setup wizard. It saves the provider and makes it active. |
llm use <name> |
Switch to another provider. With no name, it lists the configured providers. |
llm test |
Test the connection to the active provider. |
llm models |
List the models available from the active provider. |
llm add <name> |
Add a provider under that name, then offer to switch to it. |
llm set <property> <value> |
Set the active provider's model, endpoint, or apikey. |
llm remove <name> |
Remove a provider after you confirm. You cannot remove the active provider, so switch to another one first. |
llm config |
Show the settings file's location, and offer to create a default one when none exists. |
llm setup asks which provider you want to use:
http://localhost:11434 unless you change it), checks that the server answers, then lists its models for you to pick from. If the server has none, it asks for a model name. It saves the provider as ollama-local.openai or anthropic and tests the connection.llm add offers the same choice of types. The other provider types are set up in the settings file, described below.
Switching with llm use, and launching with a provider already active, both check that the provider has every field its type requires. A provider missing a required field is not used, and the message names that field.
You can define several providers. The active field selects the one in use. Each provider sits under providers, under a name you choose, and has a type and the fields that type requires:
{
"llm": {
"active": "cloud",
"providers": {
"local": {
"type": "ollama",
"endpoint": "http://localhost:11434",
"model": "your-local-model"
},
"cloud": {
"type": "anthropic",
"apiKey": "${ANTHROPIC_API_KEY}",
"model": "your-model"
}
}
}
}
| Provider | Type value | Required fields |
|---|---|---|
| Ollama | ollama |
endpoint, model |
| OpenAI | openAI |
apiKey, model |
| Azure OpenAI | azureOpenAI |
endpoint, apiKey, deployment, model |
| Anthropic | anthropic |
apiKey, model |
| Gemini | gemini |
apiKey, model |
| Groq | groq |
apiKey, model |
| Mistral | mistral |
apiKey, model |
| DeepSeek | deepSeek |
apiKey, model |
| xAI | xAi |
apiKey, model |
| Custom (OpenAI-compatible) | custom |
endpoint, model (apiKey optional) |
You can also configure a provider without editing the file. Set SCHEMASMITH_LLM_PROVIDER to its type value, then set a variable for each required field:
| Field | Variable |
|---|---|
| endpoint | SCHEMASMITH_LLM_ENDPOINT |
| apiKey | SCHEMASMITH_LLM_API_KEY |
| model | SCHEMASMITH_LLM_MODEL |
So Ollama takes SCHEMASMITH_LLM_ENDPOINT and SCHEMASMITH_LLM_MODEL, and Anthropic takes SCHEMASMITH_LLM_API_KEY and SCHEMASMITH_LLM_MODEL. Azure OpenAI's deployment has no variable, so set up Azure OpenAI in the file. Environment Variables has an example.
organization is an optional field for OpenAI.Provider names and capitalization. The name is also what a provider's stored API key is filed under, so the name is never rewritten. llm use and SCHEMASMITH_LLM_ACTIVE must name a provider exactly. A file whose active differs from a provider's name only in capitalization is corrected as it loads, unless two providers' names differ only in capitalization; then set active to the exact spelling you want. Type values are read without regard to case, but a type Ask Forge does not recognize makes the file unreadable, and ask-forge stops at launch as it does for any file it cannot parse.
A provider whose required field is missing is listed as invalid. A ${ENV_VAR} reference to a variable that is not set counts as missing.
API keys accept ${ENV_VAR} syntax for environment variable substitution. The reference is written to the file as you typed it and resolved when the key is used, so the key itself is never stored. That makes it the right choice for CI and for any host without a credential store:
{
"apiKey": "${ANTHROPIC_API_KEY}"
}
If you enter a literal key instead, as llm setup, llm add, and llm set apikey do when you type it, Ask Forge hands it to your operating system's credential store and writes only an opaque protectedApiKey token to the config file. Credential Storage covers where it goes on each operating system, what happens on a host with no store, and how a key is tied to its settings file.
Removing a provider with llm remove also removes its stored API key. A key that comes from an environment variable, such as SCHEMASMITH_LLM_API_KEY, is used for the run and never written to the settings file.
Your API key is sent as a request header, never in a request URL. A key with a stray newline or an invisible control character in it is refused as the provider starts up, with a message that names the problem and does not repeat the key back to you. Re-copy the key, taking care not to include a trailing line break.
Ollama runs models on your own machine, with no API key. Install it from ollama.com, start it with ollama serve, and pull a model. Then run llm setup and pick Ollama. If Ask Forge cannot connect, Ollama is either not running or on a different port.
Until the settings file has an llm section, Ask Forge holds one inactive provider, ollama-local, pointing at http://localhost:11434. It appears in the llm listings, and the first time you save a provider, it is written to the file too. SCHEMASMITH_OLLAMA_ENDPOINT and SCHEMASMITH_OLLAMA_MODEL change the provider with that name.
The Custom type points at any server that speaks the OpenAI API. It requires endpoint and model. apiKey is optional, so a local server such as LM Studio, vLLM, or text-generation-webui needs no key:
{
"type": "custom",
"endpoint": "http://localhost:<port>/v1",
"model": "your-model"
}
The CLI reads these variables, and they take precedence over the config file.
| Variable | Description |
|---|---|
| SCHEMASMITH_LLM_PROVIDER | A provider type value. It creates a provider named env-override and makes it active, even when SCHEMASMITH_LLM_ACTIVE names another. |
| SCHEMASMITH_LLM_ENDPOINT | The provider's endpoint. |
| SCHEMASMITH_LLM_MODEL | The model name. |
| SCHEMASMITH_LLM_API_KEY | The API key. |
| SCHEMASMITH_LLM_ACTIVE | Override the active provider name. |
The endpoint, model, and API key variables apply to env-override, so they take effect only alongside SCHEMASMITH_LLM_PROVIDER. To configure Anthropic for a session:
$env:SCHEMASMITH_LLM_PROVIDER = "anthropic"
$env:SCHEMASMITH_LLM_API_KEY = $env:ANTHROPIC_API_KEY
$env:SCHEMASMITH_LLM_MODEL = "your-model"
ask-forge
export SCHEMASMITH_LLM_PROVIDER=anthropic
export SCHEMASMITH_LLM_API_KEY="$ANTHROPIC_API_KEY"
export SCHEMASMITH_LLM_MODEL=your-model
ask-forge
Provider-specific variables create or override a named provider in the configuration:
| Variable | Description |
|---|---|
| SCHEMASMITH_OLLAMA_ENDPOINT | Override the endpoint of the provider named ollama-local. |
| SCHEMASMITH_OLLAMA_MODEL | Override its model. |
SCHEMASMITH_OPENAI_API_KEY |
Configure the provider named openai, of type openAI, with this key. |
SCHEMASMITH_OPENAI_MODEL |
Override its model. With neither this variable nor a model in the file, it uses gpt-4o. |
SCHEMASMITH_ANTHROPIC_API_KEY |
Configure the provider named anthropic, of type anthropic, with this key. |
SCHEMASMITH_ANTHROPIC_MODEL |
Override its model. With neither this variable nor a model in the file, it uses claude-sonnet-4-20250514. |
The OpenAI and Anthropic model variables apply only alongside their provider's key variable. None of these makes its provider active: select it with SCHEMASMITH_LLM_ACTIVE, or with llm use in the REPL.
Free schema-as-code for SQL Server, PostgreSQL, MySQL, and MariaDB.
The source is on GitHub for anyone to read.
Get Started on GitHub