For the complete documentation index, see llms.txt. This page is also available as Markdown.

Configuration

The bx-ai settings you will actually use, on one page.

Settings live in boxlang.json under modules.bxai.settings. Every setting has a default, so set only what you need. Your values are merged over the defaults.

{
  "modules": {
    "bxai": {
      "settings": {
        "provider": "openai",
        "defaultParams": { "model": "gpt-4.1", "temperature": 0.7 }
      }
    }
  }
}

The basics

Setting
Default
What it does

provider

"openai"

Provider used when a call does not name one

apiKey

""

Key for provider. Prefer the <PROVIDER>_API_KEY env var

defaultParams

{}

Request params for every call, such as model and temperature

timeout

90

Request timeout in seconds

returnFormat

"single"

What aiChat() returns: single, all, raw, json or xml

Providers

Give a provider its own params and options. They apply whenever that provider is used:

Profiles

A profile is a named combination of provider, model, params, options and key. Use it when you switch between setups, such as a fast model and a planner model:

See Profiles for agents, switching and listing.

Embeddings

aiEmbed() uses your chat provider unless you say otherwise:

Logging

Setting
Default
What it does

logRequest / logResponse

false

Write requests or responses to ai.log

logRequestToConsole / logResponseToConsole

false

Print them to the console. Best way to debug a provider

Everything else

You can leave these alone until you need them.

Setting
Learn more

memory

audio

security

webSearch

skillsDirectory, autoLoadSkills

gateways

API keys

  1. Set <PROVIDER>_API_KEY in the environment, for example OPENAI_API_KEY. This is the default way and needs no setting.

  2. For a profile, set apiKeyEnv to the name of the variable. The profile never stores the key.

  3. Pass apiKey in the call options to override everything else.

Override per call

A call always wins over settings:

The order, lowest to highest: defaultParams, the provider's params, the profile, the params of the call.

Full provider walkthroughs are in Provider Setup.

Last updated