Skip to main content
Version: v5

Settings & Configuration

OpenBB Python reads its configuration from ~/.openbb_platform/, a folder in the current user's home directory. user_settings.json holds provider credentials, preferences, and per-command defaults. system_settings.json holds logging, extension permissions, REST API metadata, and HTTP settings. A .env file in the same folder sets environment variables. Importing openbb creates the folder and both JSON files when they do not exist.

The settings in effect for a session are exposed as obb.user and obb.system.

from openbb import obb

obb.user.preferences
obb.system.api_settings

Resolution order​

Python interface​

When from openbb import obb runs, values in system_settings.json and user_settings.json replace the built-in defaults. Environment variables, including those declared in ~/.openbb_platform/.env, supply credentials and the OPENBB_* flags listed under Environment variables. A variable in .env never replaces one already set in the shell.

A non-empty credential in user_settings.json takes precedence over the matching environment variable. The environment variable is used when the key is missing from the file or its value is an empty string. allow_on_command_output and allow_mutable_extensions work the other way around: the environment variable sets the default, and a key in system_settings.json overrides it.

The Python interface does not apply the [system] or [user] tables of openbb.toml. Extensions that define their own tables, such as [news] for openbb-news, read them from the file locations listed in the next section.

Changes made through obb.user last for the current session and are not written back to user_settings.json. obb.system is read-only; edit system_settings.json and restart the interpreter to change it.

obb.user.credentials.fred_api_key = "your-fred-key"
obb.user.preferences.output_type = "dataframe"

openbb-api and openbb-mcp​

The openbb-api and openbb-mcp launchers read openbb.toml at startup. They first load ~/.openbb_platform/.env and the file named by OPENBB_ENV_FILE into the environment, again without replacing variables that are already set. They then merge TOML from the locations below; a higher row takes precedence over a lower one.

PrecedenceLocation
4 (highest)The file passed with --config-file, or named by an environment variable: OPENBB_API_CONFIG or OPENBB_CONFIG for openbb-api; OPENBB_MCP_CONFIG, OPENBB_API_CONFIG, or OPENBB_CONFIG for openbb-mcp.
3The nearest openbb.toml or .openbb.toml, searching from the working directory upward.
2~/.openbb_platform/openbb.toml or ~/.openbb_platform/.openbb.toml.
1 (lowest)The [tool.openbb] table of the nearest pyproject.toml above the working directory.

Tables merge key by key across layers, while strings, numbers, booleans, and lists replace the earlier value. A layer that fails to parse is skipped, except the explicit file, which stops the launcher with an error.

The merged [system] table and the top-level keys described under openbb.toml are applied on top of system_settings.json. Commands executed through either launcher read credentials, preferences, and command defaults from user_settings.json and the environment on every request, so [user] tables in openbb.toml do not reach command execution. Keep those values in user_settings.json or in environment variables.

Tables that only the launchers consume, such as [env], [launcher] for openbb-api, and [mcp] for openbb-mcp, are documented on the respective extension pages.

user_settings.json​

{
"credentials": {
"fred_api_key": "your-fred-key",
"bls_api_key": "your-bls-key"
},
"preferences": {
"output_type": "dataframe",
"show_warnings": true
},
"defaults": {
"commands": {
"/news/company": {
"provider": ["tmx", "nasdaq"],
"limit": 20
},
"/fred/economy/fred_series": {
"frequency": "m",
"transform": "pc1"
}
}
}
}

The file must be valid JSON. A trailing comma or a comment makes import openbb fail with json.decoder.JSONDecodeError.

Credentials​

The credential fields are built from the installed provider extensions. Each provider's credential names are prefixed with the provider name.

Provider packageNamespaceCredential
openbb-blsobb.blsbls_api_key
openbb-cftcobb.cftccftc_app_token
openbb-government-usobb.uscongresscongress_gov_api_key
openbb-us-eiaobb.eiaeia_api_key
openbb-fredobb.fredfred_api_key

The other V5 providers define no credentials. Some endpoints of the providers above run without their credential; the ones that need it raise Missing credential '<name>' when it is not set.

Every credential can also be supplied as an environment variable with the same name in upper case, such as FRED_API_KEY. In addition, any environment variable whose name ends in API_KEY is added to obb.user.credentials under its lower-case name.

Credential values are stored as Pydantic SecretStr objects and print masked. obb.user.credentials.show() prints them unmasked, and obb.user.credentials.origins maps each installed provider to the credential names it uses.

Preferences​

KeyTypeDefaultEffect
cache_directorystr~/OpenBBUserData/cacheLocation of provider HTTP and data caches.
chart_style"dark" or "light""dark"Default chart theme for openbb-charting.
data_directorystr~/OpenBBUserDataBase directory for user data. Command logs are written to its logs subfolder.
export_directorystr~/OpenBBUserData/exportsExport location used by the ODP CLI and passed to charting extensions.
metadatabooltrueAttach the command's arguments, duration, route, and timestamp to OBBject.extra["metadata"].
output_typestr"OBBject"Return type of commands in the Python interface.
request_timeoutint greater than 060Timeout, in seconds, for provider requests made with the core HTTP helpers.
show_warningsboolfalsePrint warnings to the console. Warnings are always attached to OBBject.warnings.
table_style"dark" or "light""dark"Table theme for openbb-charting and the ODP CLI.
user_styles_directorystr~/OpenBBUserData/styles/userFolder that openbb-charting searches for custom styles.

~ in the defaults stands for the home directory at import time. Paths you set are used as written and ~ is not expanded everywhere, so use absolute paths.

output_type accepts OBBject, dataframe, polars, numpy, dict, and llm. The model also accepts chart, but V5 has no matching conversion and commands fail with that value. The setting has no effect on REST API responses.

Command defaults​

defaults.commands maps a command path to default parameter values. Paths can be written as URL paths (/news/company) or in dotted form (news.company).

provider accepts a string or a list of provider names. In the Python interface, a command called without provider uses a single configured provider as is. With a list, it uses the first provider whose credentials are all set; providers without credentials always qualify. If none qualifies, the command raises Provider fallback failed. Commands with no configured provider use their installed providers in alphabetical order under the same rule.

Any other key sets a parameter default. The default applies when the call leaves that parameter unset, and an explicit argument always wins. With the file above, the following call uses tmx and returns at most 20 articles.

obb.news.company(symbol="RY")

The REST API applies the same parameter defaults but ignores provider; requests select the provider with their own provider parameter. Defaults do not change function signatures or docstrings. The V4 key name routes is no longer read; rename it to commands.

system_settings.json​

{
"logging_suppress": false,
"api_settings": {
"cors": {
"allow_origins": ["https://example.com"]
}
},
"python_settings": {
"http": {
"proxy": "http://proxy.example.com:8080"
},
"uvicorn": {
"host": "127.0.0.1",
"port": 8080
}
}
}

Only the keys below are read from system_settings.json; any other key in the file is ignored.

KeyTypeDefaultEffect
logging_suppressbooltrueSet to false to write command logs.
allow_on_command_outputboolOPENBB_ALLOW_ON_COMMAND_OUTPUT, else falsePermit OBBject extensions that run on command output.
allow_mutable_extensionsboolOPENBB_ALLOW_MUTABLE_EXTENSIONS, else falsePermit those extensions to modify the returned OBBject.
charting_extensionstr | nullnullAccessor name of the OBBject extension used for charts. null selects the extension registered as charting.
charting_backendstr | nullnullEntry-point name in the openbb_charting_backend group used to render charts. null keeps the engine's built-in renderer.
headlessboolfalseopenbb-charting returns figures as JSON instead of displaying them.
debug_modeboolfalseRead by openbb-charting only. Full tracebacks are controlled by OPENBB_DEBUG_MODE.
test_modeboolfalseNot acted on by openbb-core.
api_settingsobjectsee api_settingsREST API metadata, CORS, and URL prefix.
python_settingsobjectsee python_settingsDocstring generation, HTTP client, and Uvicorn options.

The remaining fields of obb.system report the environment or configure logging. They cannot be set in system_settings.json; openbb-api and openbb-mcp accept them under [system] in openbb.toml.

FieldTypeDefault
os, python_version, platformstrValues from Python's platform module
version, corestrInstalled openbb and openbb-core versions
home_directory, openbb_directorystrHome directory and ~/.openbb_platform
user_settings_path, system_settings_pathstrPaths of the two JSON files
logging_app_name"platform""platform"
logging_sub_app"python", "api", "pro", or "cli""python"
logging_frequency"D", "H", "M", or "S""H"
logging_handlerslist[str]["file"]
logging_verbosityint20
logging_rolling_clockboolfalse
logging_commit_hashstr | nullnull

Logging​

With logging_suppress set to false, each command is logged with its route, arguments, provider, and any error. Files go to <data_directory>/logs/<installation-id>/, one per session, and rotate at the logging_frequency interval: day, hour, minute, or second. Log files older than five days are deleted when a new file handler starts. logging_handlers accepts file, stdout, stderr, and noop, and logging_verbosity is a standard logging level, where 20 is INFO. The logger is named openbb.logging_service.

import logging

logger = logging.getLogger("openbb.logging_service")

OBBject extension permissions​

An OBBject extension that sets on_command_output=True runs on command results before they are returned. If such an extension is installed and allow_on_command_output is false, importing openbb raises RuntimeError. An extension that also sets immutable=False can modify the result in place and additionally requires allow_mutable_extensions. These extensions block until they finish, and their changes are not reflected in function signatures or docstrings. Install them only from trusted sources.

api_settings​

api_settings configures the FastAPI application served by openbb-api, openbb-mcp, and python -m openbb_core.api.rest_api. Changes take effect when the server restarts.

KeyTypeDefaultEffect
versionstr"1"API version; sets the URL prefix.
titlestr"OpenBB Platform API"OpenAPI title.
descriptionstr"Investment research for everyone, anywhere."OpenAPI description.
terms_of_servicestr"http://example.com/terms/"OpenAPI terms-of-service URL.
contact_namestr"OpenBB Team"OpenAPI contact name.
contact_urlstr"https://openbb.co"OpenAPI contact URL.
contact_emailstr"hello@openbb.co"OpenAPI contact email.
license_namestr"Apache-2.0"OpenAPI license name.
license_urlstr"https://github.com/OpenBB-finance/OpenBB/blob/develop/LICENSE"OpenAPI license URL.
serverslist of objects[{"url": "", "description": "Local OpenBB development server"}]OpenAPI servers entries.
corsobjectall three lists ["*"]allow_origins, allow_methods, and allow_headers passed to the CORS middleware.
custom_headersdict[str, str] | nullnullHeader names, with default values, that every command endpoint accepts. Received values are included in command log entries.

The route prefix is /api/v<version>, so the default is /api/v1. It is derived from version and cannot be set directly.

python_settings​

KeyTypeDefaultEffect
docstring_sectionslist[str]["description", "parameters", "returns", "examples"]Sections included in the generated command docstrings.
docstring_max_lengthint | nullnullMaximum length of generated docstrings; null means no limit.
httpobject{}Settings applied by the core HTTP helpers.
uvicornobject{}Keyword arguments passed to uvicorn.run.

The docstring settings are applied when the openbb package is built. Run openbb-build after changing them.

http is read by the request helpers in openbb_core.provider.utils.helpers that providers use: make_request, amake_request, amake_requests, get_requests_session, and get_async_requests_session. Keys marked aiohttp apply to asynchronous sessions only. Other keys are ignored.

KeyApplies toPurpose
cafilebothPath to a CA certificate file.
certfilebothPath to a client certificate file.
keyfilebothPath to the client key file.
verify_sslbothSet to false to skip certificate verification.
proxybothProxy URL.
timeoutbothRequest timeout in seconds.
authbothBasic authentication as [username, password].
headersbothHeaders added to every request.
cookiesbothCookies added to the session.
fingerprintaiohttpExpected SSL certificate fingerprint.
proxy_authaiohttpProxy basic authentication as [username, password].

uvicorn applies to openbb-api and to python -m openbb_core.api.rest_api. Command-line arguments passed to openbb-api take priority over it. See the Uvicorn settings reference for the accepted keys.

openbb.toml​

openbb-api and openbb-mcp read the [system] table and a set of top-level keys from the cascade described under Resolution order.

debug-mode = true
logging-suppress = false

[system.api_settings.cors]
allow_origins = ["https://example.com"]

[system.python_settings.http]
proxy = "http://proxy.example.com:8080"

[system.python_settings.uvicorn]
host = "127.0.0.1"
port = 8080

The top-level keys are debug_mode, test_mode, headless, logging_suppress, allow_mutable_extensions, and allow_on_command_output. Each can be written in snake case or kebab case (debug-mode) and is equivalent to the same key under [system]; when both are present, the top-level key wins. The launchers also export each one as OPENBB_<KEY>, for example OPENBB_DEBUG_MODE, unless that variable is already set, so debug-mode = true turns on full tracebacks.

Keys inside [system] and its sub-tables must match the field names in the tables above exactly. Setting prefix under [system.api_settings] has no effect; set version instead.

Environment variables​

Boolean variables accept true, t, 1, yes, y and false, f, 0, no, n, in any letter case. Other values raise ValueError. Variables are read when openbb is imported or a launcher starts, so set them beforehand.

VariableDefaultEffect
OPENBB_DEBUG_MODEfalseRaise exceptions with their full traceback instead of the condensed [Error] -> message. The REST API re-raises instead of returning an error response.
OPENBB_AUTO_BUILDtrueOn import, rebuild the openbb package when the installed extensions differ from the last build. With false, run openbb-build after installing or removing extensions.
OPENBB_DEV_MODEfalseAdd the /system and /user/me endpoints, under the API prefix, to the REST API. /user/me returns stored credentials in plain text.
OPENBB_API_AUTHfalseRequire HTTP Basic authentication on REST API endpoints.
OPENBB_API_USERNAMEunsetUsername accepted when OPENBB_API_AUTH is on. Requests are rejected unless both username and password are set.
OPENBB_API_PASSWORDunsetPassword accepted when OPENBB_API_AUTH is on.
OPENBB_API_AUTH_EXTENSIONunsetName of an installed openbb_core_extension entry point whose module provides router, auth_hook, and user_settings_hook, replacing the built-in Basic authentication.
OPENBB_ALLOW_ON_COMMAND_OUTPUTfalseDefault for allow_on_command_output.
OPENBB_ALLOW_MUTABLE_EXTENSIONSfalseDefault for allow_mutable_extensions.
OPENBB_CONFIGunsetPath of the highest-precedence openbb.toml layer.
OPENBB_ENV_FILEunsetAdditional .env file loaded by openbb-api and openbb-mcp.
HTTP_PROXY, HTTPS_PROXYunsetProxy used by the core HTTP helpers.
REQUESTS_CA_BUNDLEunsetCA bundle used by the core HTTP helpers.
Credential name in upper case, such as FRED_API_KEYunsetProvider credential. See Credentials.

To persist variables, add them to ~/.openbb_platform/.env:

FRED_API_KEY=your-fred-key
OPENBB_DEBUG_MODE=true

To set one for the current session only, assign it before importing openbb:

import os

os.environ["OPENBB_DEBUG_MODE"] = "true"

from openbb import obb