Connecting self-hosted Metabot to your own AI provider

Metabot on a self-hosted Metabase needs an AI provider behind it. This page covers how to choose that provider, configure keys and base URLs, and check where prompts and results go.

On this page

Connecting self-hosted Metabot to your own AI provider: what it changes

Choosing an AI provider for Metabot on a self-hosted instance decides which company receives the prompts your users type and the schema context Metabase sends along with them. For a team that already runs Metabase inside its own network, that is the first question to settle, before anyone enables the feature for a group. Metabot is not a passive viewer of dashboards: to answer a question or draft SQL, it sends the user's request together with information about the tables and columns involved, and the provider's response returns to the instance. The data in query results is a separate matter covered elsewhere, but the metadata and prompt text are what the provider sees on every request. Confirm with your security team which of these fields your data classification allows to leave the network before you configure anything.

Metabase documents a set of supported AI providers, and the current list, along with the settings each one needs, is on the supported AI providers page. Each provider's API base URL can be overridden through environment variables, for example MB_LLM_ANTHROPIC_API_BASE_URL or MB_LLM_OPENAI_API_BASE_URL. That override is the mechanism that lets you point Metabot at an endpoint you operate, or at a gateway in front of a provider, instead of the provider's public service. Check the exact variable names for your version against that page, because the override exists per provider and not every provider may offer the same option.

You need your own provider account when your organization must hold the contract, the API key, the logging settings and the data processing terms itself, which is common where procurement or regulators require a direct relationship with the model vendor. A route through a cloud account or a private endpoint is the better fit when AI traffic has to stay inside an existing cloud agreement. Cost follows the provider's own usage billing and is paid to that provider, not to Metabase or DeployOpen, so ask each provider for its current pricing, retention and training terms in writing. Record which provider and base URL each environment uses, because a change in either alters where prompts go.

Provider options for Metabot and when each fits

This table compares the three routes for the model behind Metabot on a self-hosted instance: direct provider keys, base URL overrides, and self-hosted models behind a compatible endpoint. Read each row against your own data handling rules, who pays for model usage, and how much operating work your team can take on. Confirm each provider's current model list and terms with Metabase and the provider before you commit.

RouteData handlingCost ownership and operating effort
Direct provider keyPrompts and results go to the provider's own API endpoint under that provider's terms. Confirm retention and training terms with the provider.You pay the provider per usage using your key. Metabase sets the key and default endpoint, so operating effort is low.
Base URL override to a gatewayTraffic goes to the gateway URL you set, for example through MB_LLM_OPENAI_API_BASE_URL or MB_LLM_ANTHROPIC_API_BASE_URL. Data leaves your instance but stays inside the path you control.Gateway hosting and keys are yours to run. Usage cost still goes to the upstream provider, so budgets need to be tracked at the gateway.
Base URL override to a private provider endpointPrompts go to an endpoint in your own network or cloud account. Confirm the endpoint is reachable from the Metabase host and that it does not forward traffic elsewhere.You run the endpoint and its capacity. Effort includes certificates, scaling and monitoring, and the cost of compute is recurring.
Self-hosted model through a compatible endpointPrompts stay inside your network when the serving engine runs there. Confirm that the endpoint accepts the request format Metabase sends.You pay for hardware or cloud compute and model operations. This route carries the highest setup and upkeep effort, and it fits teams with capacity to run inference.
Check before you chooseAsk the provider for its current data retention, training and region terms, and ask Metabase which providers and settings the version you run supports.Ask for the one-time setup and recurring costs of each route in writing, and confirm which team owns key rotation and endpoint patching.

How to configure a provider key and base URL

This sequence takes a self-hosted Metabase from no AI provider to Metabot answering questions through a provider you chose, with the key kept out of the config file and the traffic confirmed at the endpoint you intended.

  1. Choose the provider and endpoint

    The platform owner and the data owner agree which provider Metabot will call, whether that is a hosted API, a model in your own cloud account, or a self-hosted server. Record the provider, the model, and the base URL that will receive requests. If the endpoint is a private gateway or a self-hosted server, confirm with the team that runs it that it is reachable from the Metabase host and that its data handling terms match what your compliance team has approved. Done when the choice and endpoint are written down and signed off.

  2. Create and store the API key securely

    Generate the key in the provider's console using a dedicated service account or project so it can be scoped and rotated without affecting other workloads. Store it in your secrets manager or the platform's secret injection mechanism, not in a file committed to version control or a shared configuration document. Confirm with the provider which spend limits, model access and key permissions are available for that key. Done when the key exists only in the secrets store and the owner can name who can read and rotate it.

  3. Set the provider environment variables

    Add the provider's key variable to the Metabase process environment, sourced from the secret store at deploy time. If the provider's default API address is not the one you need, set the matching base URL override as well, such as MB_LLM_ANTHROPIC_API_BASE_URL for Anthropic or MB_LLM_OPENAI_API_BASE_URL for OpenAI-compatible endpoints. Check the supported providers page for the exact variable names for your version before you write them down. Done when the variables appear in the running container or service definition and nowhere else in plain text.

  4. Restart the instance and confirm the settings loaded

    Restart Metabase so it reads the new environment. Sign in as an administrator and open the AI settings in the admin area to confirm the provider is recognized and the model is selected. If the setting does not appear or shows an error, check the startup logs for the variable name and confirm there are no typos. Note that the key value should never be printed in logs. Done when the admin interface shows the expected provider and the logs show no configuration errors.

  5. Check outbound network rules

    From the Metabase host or its container, confirm that outbound HTTPS to the chosen base URL is allowed by the firewall, proxy and egress policy. Test name resolution and the TLS handshake with a standard client tool, and check that any corporate proxy settings apply to the Metabase process. If the endpoint is internal, verify that no traffic is routed to a public address by mistake. Done when a connection test to the endpoint succeeds from the Metabase host and the egress rules match the approved design.

  6. Ask Metabot a test question

    Using a test account with limited data access, ask Metabot a simple question against a non-sensitive database. Metabot should return a response in the chat interface without an error message. Keep the question and the test account on record so the test can be repeated after upgrades or key rotation. Done when the response arrives and the test account reports no permission errors.

  7. Confirm requests reach the intended endpoint

    Verify that the provider actually received the request. Check the provider's usage or request dashboard for activity under the new key, and compare the time and volume with the test question. If the endpoint is your own gateway or self-hosted server, check its access logs for the request. If activity appears on a different account or endpoint, stop and correct the base URL before allowing more users. Done when the request is visible at the intended endpoint and nowhere else.

  8. Record the configuration for review

    Document the provider, model, base URL variable, secret location, key owner, egress rule and test results in the platform record. Ask the provider for its current data retention and training terms in writing, and ask your compliance team to file them with the configuration. Schedule a key rotation owner and a re-test after each Metabase upgrade. Done when the record is complete and the compliance team has acknowledged it.

What data leaves the instance for each provider

Whichever provider you choose, Metabot sends data outside your Metabase instance on every AI request, so the data leaving the instance is the first question to settle. Depending on the feature and the request, the payload can include the user's natural language question, schema context such as table and column names that Metabot needs to write a query, and query results that Metabot reads to answer. Your own provider key does not change what is sent. It changes who receives it and under which contract. Before enabling Metabot, have your security team confirm with Metabase exactly which fields go into each request type in the version you run, and whether any data is sent for feature use that a user does not see on screen.

The base URL override determines the destination of that payload. Each provider's API base URL can be overridden through settings such as MB_LLM_ANTHROPIC_API_BASE_URL or MB_LLM_OPENAI_API_BASE_URL. Pointing the override at a gateway, a private endpoint or a self-hosted server moves the destination, but it does not make the traffic private by itself. The receiving service still sees the prompts and results, and its own logging and retention decide what happens next. Record the exact base URL, the network path to it and the owner of that endpoint in your configuration review. A typo or a stale override can silently send traffic to an unintended host, so check the effective value after each change. The current list of supported providers and their settings is in the Metabase supported AI providers documentation.

Review each provider's retention and training terms before you send production data. Retention periods, whether prompts or outputs may be used for model training, the regions where data is processed and the subprocessors involved vary by provider, plan and contract, and they change over time. This guide does not state any provider's policy. Ask each provider for its current terms in writing, confirm whether your account tier or enterprise agreement changes them, and file those answers with your data processing records. If the answer depends on an opt-out setting, confirm that the setting is applied to your account and record the date you checked it. Repeat the review when you change providers, change models or upgrade Metabase, since the data sent may change with the release.

Security controls for AI provider credentials and traffic

The AI provider is an outbound dependency that holds a credential and receives prompt and schema context from your Metabase instance. The controls below cover how that credential is stored and rotated, what the provider account is allowed to do, where traffic can go, and who can change the settings that route it.

Store and rotate the provider key

Keep the provider API key in your secrets manager or the container platform's secret store, and inject it into Metabase as an environment variable at start-up rather than writing it into shared configuration files or the application database. Set a rotation schedule and confirm that rotating the key does not require editing the instance by hand. Check whether old keys stay valid after rotation so you know when a leaked key stops working.

Scope the provider account

Create a dedicated provider account or project for Metabase, separate from developer and research keys. Ask the provider which spending limits, model allowlists and per-key permissions are available, and set the tightest ones your team can operate. Review usage by key so a misuse or runaway integration is visible under its own identity.

Control egress to the endpoint

Allow the Metabase host to reach only the provider endpoint or the internal model server it is configured to use. Enforce this with firewall or proxy rules that block all other outbound AI destinations. If the base URL points to an internal server such as a self-hosted model, confirm that the server is not reachable from other networks and that the Metabase host can resolve only the intended name.

Review TLS and trust settings

Confirm that the base URL uses HTTPS and that certificate validation is not disabled. For private endpoints signed by an internal certificate authority, add that CA to the trust store used by the Metabase JVM and container rather than bypassing verification. Ask your security team to test a certificate change in staging, because a broken trust chain can stop Metabot without an obvious error.

Log configuration changes

Record every change to the AI-related environment variables, including the provider, base URL and key reference, in your change management system or infrastructure logs. Metabase's own activity data does not replace this record, so confirm that your deployment tooling keeps a history of container or service definitions. Review the log when Metabot behavior or spending changes unexpectedly.

Restrict who edits environment variables

Limit write access to the deployment definitions, Helm values, service units and secret stores that hold Metabase's AI settings to a small platform group. Require review for changes that alter the provider or base URL, since redirecting the base URL sends prompt context to a new destination. Developers and analysts should not be able to change these settings through the Metabase admin interface or the host.

How a Metabot request reaches your chosen provider

The request starts with a user's question in Metabase, which the self-hosted instance sends to the AI provider named in its configuration. Each provider has an API base URL that can be overridden through environment variables, so the endpoint may be a vendor's public API or a private endpoint you run. Check the trust boundary before go-live: the key, the base URL and the network path decide where prompts and query context travel. Confirm the exact variable names for your provider in Metabase's supported providers documentation.

Metabot requests leave Metabase through a configured base URL to either a vendor API or a private endpoint.

Limits to confirm before you choose a provider

Metabot's provider settings depend on your Metabase version, your plan and the provider's own terms. The items below are the points to confirm with Metabase and your provider before you write any keys or base URLs into a production configuration.

Supported providers and model names

Start by confirming which AI providers your Metabase version supports and which model names it accepts for each one. Model names change as providers retire older models, so a name that works in a test instance may fail after a provider update. Ask Metabase for the current list in writing, then record the exact model identifier you plan to use so that your change record matches what runs in production.

Supported AI providers

Base URL overrides by version

Confirm that the base URL override works for each provider in the exact Metabase version you run. Overrides are set through environment variables such as MB_LLM_OPENAI_API_BASE_URL and MB_LLM_ANTHROPIC_API_BASE_URL. Test the override on a staging instance by sending one prompt and checking the outbound destination in your network logs, because a silently ignored variable would send traffic to the public provider endpoint.

Plan requirements for Metabot features

Check which Metabot features are included in the plan you buy, and whether any AI-related controls depend on a paid plan. Metabase's pricing page places SSO, row and column permissions, and usage analytics and auditing in Pro and Enterprise, so an open source instance may lack the access controls you need to limit who sends prompts. Get the plan entitlements in writing before budgeting.

Provider rate limits and spend

Provider rate limits and billing rules belong to your provider account, not to Metabase, so confirm them directly with the provider. Ask about requests per minute, tokens per minute, daily spend caps and whether the account uses prepaid credit or invoicing. Metabase usage that spikes during a dashboard refresh can hit a rate limit and return errors to users, so set limits on your side before rollout.

Upgrade effects on provider settings

Confirm whether an upgrade changes provider settings, environment variable names, default models or supported providers. Metabase upgrades run application database migrations automatically, and the docs recommend backing up the application database first. Record your provider configuration in version control, then test it on the target version before you upgrade production, so a changed setting does not stop Metabot without warning.

Upgrading Metabase

Release support windows and end-of-life dates

Find out how long your Metabase version receives security fixes, because a provider setting that works today may be unsupported on a version that reaches end of life. Metabase publishes support windows for LTS and non-LTS releases on its version support page. Plan provider reviews around those dates so that a forced upgrade does not coincide with a provider model change.

Metabase version support

Common questions about configuring Metabot's AI provider

Who pays for the model usage when Metabot runs on my own provider account?

Your organization pays the model provider directly, because the API key and billing belong to your account with that provider. Metabase's licensing does not include model tokens, so the bill depends on how much your users ask Metabot and which model you choose. DeployOpen's work is scoped separately and is not a usage charge. Before you configure anything, ask the provider for its current per-token pricing and set a monthly spending limit on the account. Pair that with the usage controls described in the AI usage controls topic so that cost stays predictable.

How long does it take to connect Metabot to an AI provider?

The connection itself is a short configuration change: a provider key, a model choice and, where needed, a base URL set through environment variables. The time that varies is everything around it: approving the provider with your security team, deciding which network paths are allowed, testing answers against your real data permissions and agreeing on who can use the feature. Ask any partner for a fixed-scope quote that lists those steps, the environments covered (test and production) and the review cycles included, rather than a single hours figure.

What must my team supply before configuring the provider?

Your team needs to supply four things: a provider account with an API key, a model choice that your security and data owners have approved, network rules that allow the Metabase server to reach the provider endpoint, and a place to store the key securely. If you use a private or self-hosted model, you also need its base URL and a decision about which networks may call it. Confirm each item with the provider's documentation and your own environment, since requirements for keys and endpoints can change between releases.

Can our own team configure Metabot's provider without a partner?

Yes, if your team can manage Metabase environment variables, container or service configuration and secrets. The steps are documented in Metabase's supported AI providers page, and the main risks are misplaced keys, a wrong base URL that silently sends traffic elsewhere, and an overlooked outbound rule. A partner adds value mainly where you need the setup reviewed against your data handling rules, tested with your permission model and documented for auditors. Decide based on your team's capacity and on whether the review evidence is something you must produce in-house.

How do we confirm where Metabot prompts and query results actually go?

Confirm it by testing, not by assumption. Set the base URL explicitly, send a test question, and watch outbound connections from the Metabase host with your network monitoring or egress logs. Check that only the configured provider or private endpoint receives traffic, and record the result. Also confirm with the provider what it retains and whether it trains on inputs, using its current data terms. Keep the test output and the configuration as evidence for your security review.

Which AI provider setting is most likely to cause a data exposure problem?

The most common risk is an API base URL that points to an unintended endpoint, either because an old override was left in place or because a copied configuration came from another environment. Each provider's base URL can be overridden through its own environment variable, for example MB_LLM_OPENAI_API_BASE_URL or MB_LLM_ANTHROPIC_API_BASE_URL, so review every variable in the running process, not only the one you meant to change. Add a periodic check of those values to your change process.

What should we ask for in a quote for this configuration work?

Ask for a written scope that names the Metabase version, the providers in scope, the deployment type and the environments covered. Ask which items are one-time (setup, network review, testing, documentation) and which recur (model usage through your provider account, provider changes, Metabase upgrades that may affect configuration). Ask what evidence is delivered, such as configuration records and egress test results, and confirm that the quote excludes any claim of audit or certification, which independent auditors provide.

How provider choice gets decided and tested

The provider behind Metabot is settled in a scoping discussion before anyone edits a configuration file, because three decisions depend on each other: which provider is used, how the data sensitivity of the Metabase databases is classified, and which network path the requests take. Start by listing the databases Metabot may query and the tables and columns in them, then mark each one by sensitivity using your own data classification scheme. The highest classification in scope usually decides whether a hosted provider API is acceptable, whether a provider under an existing cloud agreement is required, or whether a self-hosted model is the only option. Record the outcome as a short decision note that names the provider, the base URL if one is overridden, the environment variables that will hold credentials, and the owner who approves the data exposure.

The network path is the second decision. Confirm whether the instance can reach the provider endpoint directly, through an egress proxy, or only inside a private network, and check that your firewall rules allow exactly that route. Confirm with the provider's documentation which data it retains, for how long, and whether it is used for training, since those terms vary by provider and plan and must be read against the version you buy. Verify the pricing model with the provider and ask your procurement team to capture the usage limits in the contract. Tell your security reviewers that the decision note is the evidence they will be asked to approve.

Verify the result in a separate test instance built from the same Metabase version and configuration as production, but with a sample database that contains no restricted data. Send prompts that exercise each permission group, confirm that requests reach only the intended base URL, and check the provider's logs and your own network logs for the same calls. Also confirm that a deliberately invalid key fails cleanly and that secrets do not appear in Metabase logs. Only after these checks pass should the production configuration change, and the test results should be kept with the decision note so the next upgrade or provider change can be checked against the same evidence.

How DeployOpen scopes and supports Metabot provider setup

DeployOpen plans, implements, documents and supports self-hosted open-source platforms inside your own infrastructure. For Metabot, that means agreeing in writing which AI provider you will use, how the connection is configured on your instance, and what data leaves your network before any change is made.

How we scope

  • Confirm which AI provider Metabot will call and whether the provider is a hosted API, a cloud account or a self-hosted server.
  • Record the data classes that may reach the provider, including questions, schema context and query results.
  • Agree in writing the environment variables, provider keys and base URL overrides to be set, and who owns each secret.

How we build

  • Configure provider keys and any API base URL overrides in your instance's environment, not in shared documents or chat.
  • Test Metabot against a non-production instance and a test data source before enabling it for real users.
  • Check that the provider endpoint is reachable only from the networks you approve and that outbound traffic matches the agreed design.

How we hand over

  • Deliver a written record of the provider choice, configuration keys, secret locations and network paths used.
  • Document the data handling position for the chosen provider so your security and compliance teams can review it.
  • Walk your operators through key rotation, provider changes and how to confirm Metabot is calling the intended endpoint.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and provider changes can be covered by a retainer, scoped to your instance.
  • Ask for the retest and re-review steps included in your quote, especially after a Metabase upgrade or a provider change.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.