Testing IBM watsonx.ai models with promptfoo

Point promptfoo at watsonx.ai text and chat models, confirm which models your region and account can call, and move any IBM BAM configuration to watsonx before it breaks.

On this page

Testing watsonx.ai models with promptfoo before they reach users

If your team runs IBM watsonx.ai models and needs repeatable evals and red team scans before users see the output, promptfoo supports watsonx.ai text generation and chat APIs through its watsonx provider, and which models you can call depends on your region and account. Model availability varies, so the same suite may run cleanly in one region and fail with an unavailable-model error in another. Before writing any configuration, confirm which model IDs your account can reach in the region where your project lives.

promptfoo runs on the machine that starts the test. It does not send your prompts through a promptfoo service, because the software talks directly with the model endpoint. That matters for watsonx.ai deployments where data residency and credential handling are reviewed by your security and compliance teams. Ask them to approve the workstation or CI runner that will hold the watsonx credentials, and decide whether those runners are inside the same boundary as the project.

If older configurations still point at the IBM BAM provider, plan the move now. promptfoo's documentation describes migrating from the IBM BAM provider, which was sunset in March 2025, so BAM-based suites should be rewritten against the watsonx provider rather than left to fail. Inventory every config file, CI job and shared dataset that references the old provider, then run each suite against watsonx.ai and compare results before you retire the old references. Review the promptfoo watsonx documentation for the current provider settings and migration steps.

What you need before the first watsonx.ai eval runs

Five things need to be in place before promptfoo can call watsonx.ai. Each one fails in a different way, and most failed first runs trace back to one of these items rather than to the eval itself. Confirm them in order so the first run tests the models rather than the setup.

Node.js version that meets the requirement

promptfoo's npm release 0.124.1 requires Node.js 22.22.0 or newer. Check the runtime on the exact machine or CI image that will run the eval, not only on your laptop, because older base images are common in pipelines. Run node --version there before installing anything, and pin the promptfoo version you tested so later upgrades do not change the setup silently.

promptfoo on npm

watsonx.ai project with the target models

Models are tested inside a watsonx.ai project, so the project must contain or be able to access each model you intend to evaluate. Record the project and the exact model IDs your suite will call. Ask the platform owner whether the project was created in the region you plan to use, because a project in one region does not give you models offered only in another.

IBM Cloud credentials for API access

The provider needs credentials that allow API calls to watsonx.ai, usually an IBM Cloud API key tied to a service identity rather than a personal login. Confirm with your IBM Cloud administrator which identity holds the watsonx.ai access role for the project. Store the key in your secrets manager or CI variables, never in the promptfoo configuration file, and rotate it on the schedule your security policy sets.

Network egress to the watsonx endpoint

The machine or CI runner that calls the model must be able to reach the watsonx.ai API endpoint for your region over HTTPS. Corporate proxies, egress allow lists and private network rules often block this path. Test reachability from the actual runner with a single request before the suite runs, and confirm with your network team whether traffic must pass through an approved proxy.

Confirmed model list for your region

Model availability varies by region and account, so do not assume a model listed in documentation is available to you. Build a short list of the model IDs you plan to test and check each one against the endpoint your account can reach. Confirm the exact model IDs and endpoints against the promptfoo watsonx documentation before you write them into configuration, since names and endpoints can change.

promptfoo watsonx docs

How to configure the watsonx.ai provider step by step

This sequence takes you from a clean Node.js install to a working watsonx.ai text model and chat model in one promptfoo config, with credentials kept out of the file. It ends with a smoke-test eval, a stored result you can review, and assertions that grade each answer.

  1. Check Node.js and install promptfoo

    Your engineer runs this on a workstation or CI runner that can reach watsonx.ai. The promptfoo npm release requires Node.js 22.22.0 or newer, so run node --version first. Then install the CLI with npm install -g promptfoo and run promptfoo --version. Pin the version you tested in your pipeline so later upgrades stay deliberate. The step is done when the command prints a version number and no Node.js error appears.

  2. Confirm watsonx.ai model IDs for your region

    Model availability varies by region and by account, so list the text and chat models your watsonx.ai project can call before you write any config. Open the promptfoo watsonx provider docs to confirm the provider ID format for each model type and the credentials it expects. The step is done when you have one text model ID and one chat model ID written down, each confirmed as available in your target region.

  3. Create a minimal promptfooconfig.yaml

    Create a project folder and a promptfooconfig.yaml file with two entries under providers, one for the text model and one for the chat model, each using the provider ID you confirmed. Add one prompt under prompts and one test under tests with a short, factual question. Keep keys and secrets out of this file. The step is done when the YAML parses and promptfoo lists both providers and the single test when it loads the config.

  4. Supply credentials through environment variables

    Set the credential variables that the watsonx provider docs name for your authentication method. Set them in your shell for local work or in your CI secret store for pipelines, and keep them out of the config file so the file can be committed safely. Use an account whose access is limited to the models you chose. Confirm the exact variable names in the provider docs before you start. The step is done when promptfoo eval starts without a missing-credential error.

  5. Run a smoke-test eval

    Run promptfoo eval from the project folder. Each provider receives the same prompt, and the terminal shows an output from each model for the test. This first run is your successful test call, so both the text model and the chat model should return an answer without an error. If a call fails, the cause is usually a model ID, region or credential problem, so fix it here before you add anything else.

  6. Review the stored result in the web viewer

    Run promptfoo view to open the local web interface. The run you just made should appear in the list, with both models' outputs shown alongside the prompt and the test. Open the run to confirm the outputs match what the terminal showed. The step is done when you can find and open this run. Results stay on your machine because the CLI runs locally and talks directly to the model.

  7. Add assertions to grade each answer

    Add an assert list to your test, starting with a deterministic check such as contains, which requires a word that a correct answer must include. Run promptfoo eval again and confirm that each output is marked as a pass or a fail in the results. Then change the expected word to one the model will not produce and confirm the test fails as intended. The step is done when the pass and fail counts match what you expect.

Why regional model availability decides your test matrix

The same watsonx.ai model name may not be offered in every region, or to every account, so a promptfoo suite can pass in one environment and fail in another without any change to the application. Treat model availability as part of the test matrix, not as a setup detail. Before you write assertions, confirm for each region and account you will test which text and chat model IDs are actually callable, using the IBM documentation and a live call from the environment where the suite will run. Availability is not something this page can list for you, so ask IBM or your account team to confirm it for your specific tenancy.

Build a per-region list of model IDs as a version-controlled file, with one entry per region, the account or project it was checked against, and the date of the check. Reference those entries from separate promptfoo provider blocks or from environment-specific configuration files, so that a run in one region never silently falls back to a model that exists only elsewhere. Record the region in the output of every result, for example by adding it to the test metadata or the run name, so that a failure in a shared report can be traced to the endpoint that produced it. Without that record, comparisons across regions become guesses.

Check the grader model in the same pass. If you use an LLM-as-a-judge assertion or a model-graded red team strategy on watsonx.ai, the grader must also be available in the region under test, or the grading step will fail for reasons that look like application defects. Include the grader ID in the per-region list, and make the preflight step fail fast when either the target or the grader is missing. Note that a grader in a different region also changes where grading traffic goes, which matters if your data residency rules apply to evaluation data as well as production data.

Credential options for local runs, CI and shared servers

On a developer laptop, the simplest setup keeps watsonx.ai credentials in the shell environment or in a local .env file that stays out of version control. promptfoo runs locally and calls the provider directly, so the credential does not need to pass through a shared server. The main risks on a laptop are accidental disclosure through a copied config, a pasted terminal log or a shared screen, rather than network exposure.

  • Keep secrets in the environment: Load the credential fields listed on the provider page from your shell session or a local .env file, and reference them from the config instead of typing values into promptfooconfig.yaml.
  • Ignore the secret file: Add .env and any local override files to .gitignore before the first commit, and check git status before every push.
  • Use a scoped test key: Create a key for evaluation work only, limited to the project or space used for tests, so a leaked laptop key does not expose production model use.
  • Rotate on exposure or departure: Replace the key when a team member leaves, when a laptop is lost, or when a key appears in a log, screenshot or ticket.
  • Review before sharing: Check a config for literal keys before sending it to a colleague or attaching it to a ticket.

Confirm in the watsonx provider documentation which fields your account and region require, and whether the provider reads them from environment variables by default or needs them set in the config.

Moving an old IBM BAM configuration to watsonx.ai

Any promptfoo configuration that still points at the IBM BAM provider will not run as written, because that provider was sunset in March 2025. Treat the migration as a required change rather than an optional upgrade, and plan it before the next scheduled eval or red team run fails. The first step is an inventory of every config file, test suite, red team configuration and CI job that references the BAM provider. Search your repositories for the provider identifier and check pipeline definitions, shared config fragments and scheduled jobs, since a single modular config can be pulled into several suites that look unrelated.

Next, map each BAM model to a watsonx.ai model that your account can call in your region. Model availability varies by region and account, so do not assume the successor model you expect is enabled for your project. Confirm the available models with IBM and with your own watsonx.ai project, then record the mapping in a table that names the old model, the new model, the region and the owner who approved the change. Update provider settings using the field names in the migration section of the promptfoo watsonx docs, since authentication and model fields differ from the old configuration.

Re-run your existing assertions against the new models before you trust any pass rate. Different models produce different wording, formatting and refusal behavior, so assertions tied to exact strings, JSON shape or length will often fail even when the application still works. Separate real regressions from assertion brittleness by reviewing failed outputs by hand. Keep the old BAM results, including outputs, scores and the config version that produced them, in a read-only location. That archive is the only baseline you have for comparing old and new behavior, and it gives auditors and reviewers evidence of what changed and when.

Mapping BAM settings and watsonx.ai settings

This table maps each setting a team carries over from the retired IBM BAM provider to its watsonx.ai counterpart in promptfoo. Read the watsonx column as the item to fill in, and check every row marked for confirmation against the watsonx provider docs before you write configuration. The main takeaway is that the BAM provider was sunset in March 2025, so model names, regions and API choice must be validated against your own watsonx account.

SettingLegacy BAM configurationwatsonx.ai configuration
Provider identifierOld BAM provider ID, sunset March 2025watsonx provider ID for text or chat. Confirm the exact identifier in the docs
Model identifierBAM model name from the old configwatsonx model ID offered in your region and account. Confirm the exact format
Project or space referenceNot a direct carry-over. Confirm before migratingProject or space identifier, if your setup requires one. Confirm the field name
Credential variablesFormer BAM API key variablewatsonx credential variables. Confirm the names and keep secrets out of config files
Endpoint or regionFormer BAM endpoint settingRegional watsonx.ai endpoint matching where your models are available. Confirm the setting
Chat versus text APISingle generation call used in the old configChoose the watsonx text generation or chat API based on the model and use case
Model availabilityAssumed available once configuredVaries by region and account. Verify the model is offered before running evals

Securing watsonx.ai credentials and test data

A promptfoo run against watsonx.ai is a set of outbound calls from the machine or runner that executes it, so the credentials, the prompts and the responses all move through infrastructure you choose. The cards below cover where secrets live, which identity the run uses, where data flows, what goes into test cases, and which systems red team probes may touch.

Store credentials in a secrets manager

Keep the watsonx.ai API key and project or space identifiers in a secrets manager or your CI platform's secret store, and inject them as environment variables at run time. Avoid committing them to the promptfooconfig.yaml file or pasting them into shared eval reports. Check that CI logs mask the values and that the promptfoo config references variables rather than literal keys.

Use a dedicated least-privilege identity

Create a service identity for promptfoo runs, separate from any production application, and grant it access only to the watsonx.ai project or space that holds the models under test. Confirm with IBM how that identity's API key is scoped and rotated in your account. Do not reuse a personal developer key, since removing one person's access would also break every pipeline that depends on it.

Keep prompts and responses on approved infrastructure

The promptfoo documentation states that evals run on your machine and talk directly with the LLM, so prompts go from the runner to watsonx.ai and responses come back to it. Confirm that the watsonx.ai region and service terms match your data residency rules, and that the machine or runner that stores eval output is covered by the same controls.

promptfoo introduction

Redact sensitive test data

Test cases built from production tickets, patient notes or account records can leak personal data into prompts, cached results and reports. Replace identifiers with synthetic values before the data enters a test file, and review the output directory before sharing it. Keep one redaction step in the pipeline so that every new dataset passes through it.

Limit red team probes to authorized targets

Red team scans send adversarial prompts at high volume, which can trigger rate limits, consume paid capacity and expose weaknesses in a live system. Run probes only against watsonx.ai projects and application endpoints that your organization owns or has written authorization to test, and record that authorization alongside the scan configuration.

Share results through Enterprise with SSO

The Community edition runs on individual machines and does not provide team sharing. Team sharing, teams-based access control and SSO are part of the promptfoo Enterprise tier, and the self-hosted app has no built-in authentication or SSO. Until your team has that tier in place, pass reports through approved channels and confirm who may open them.

promptfoo pricing

Common watsonx.ai and promptfoo failures and fixes

This table lists the failures teams most often hit when pointing promptfoo at watsonx.ai, with the likely cause, the check to run and the fix for each. Work down the rows in order, since a wrong Node.js version or blocked network path can look like a credentials problem.

FailureLikely causeCheck and fix
Model not found in regionThe model ID exists in another watsonx.ai region or is not enabled for your account, so the request for that ID fails.Confirm the model is listed for your region and account in IBM's watsonx.ai documentation, then change the model ID or the region setting in your promptfoo config.
Authentication rejectedThe API key, project or space ID, or the region URL does not match the account the credentials belong to.Verify each credential value against the IBM Cloud account that owns the project. Re-create the API key if needed and keep it in an environment variable, not in the config file.
Outdated BAM provider identifiersThe config still uses the IBM BAM provider, which was sunset in March 2025, so the old provider ID no longer works.Replace the BAM provider entry with the watsonx.ai provider and map each old model name to a current watsonx.ai model ID, following the migration notes in the promptfoo watsonx docs.
Node.js version too oldThe promptfoo release in use requires Node.js 22.22.0 or newer, so an older runtime fails at install or startup.Run node --version in the same shell that runs promptfoo. Upgrade Node.js to 22.22.0 or newer, then reinstall promptfoo in that environment.
Network blocked to the watsonx endpointA firewall, proxy or egress policy in your CI runner or workstation blocks outbound HTTPS to the watsonx.ai API host.Test reachability of the regional watsonx.ai endpoint from the same host that runs the eval. Ask your network team to allow that host over HTTPS, or configure the proxy settings your environment requires.
Chat versus text API mismatchA chat model is called through the text generation provider, or a text model is called through the chat provider, so the request shape or response parsing is wrong.Check the model type in IBM's model catalog, then use the chat or text watsonx.ai provider variant that matches it. Run one prompt manually first to confirm the response shape before writing assertions.

How a promptfoo run reaches watsonx.ai

The run starts with an engineer or CI runner invoking the local promptfoo CLI, which reads its config and credentials from the team's environment. Requests leave the team's network and cross into IBM Cloud to reach the watsonx.ai text or chat endpoint, which is where regional model availability and account access are decided. The grader model and the results store sit in their own boundaries, so the reader can check which system sees which data before the first run.

Requests and results flow across the team's trust boundary to IBM Cloud.

Questions teams ask before testing watsonx.ai with promptfoo

Does it cost anything to test watsonx.ai models with promptfoo?

The promptfoo Community edition is free and includes all LLM evaluation features, all model providers and integrations, and red teaming with 10k probes per month, with community support. The watsonx.ai provider is part of that set, so connecting promptfoo to watsonx.ai does not add a promptfoo license fee. Your costs come from IBM watsonx.ai usage itself, since every eval and red team probe sent to a watsonx.ai model is billed under your IBM account, and from any internal or partner effort to build the suite. Confirm your watsonx.ai commercial terms and rate limits with IBM before planning large test volumes.

What does promptfoo Enterprise add for watsonx.ai testing?

Enterprise adds team sharing, teams-based access control and SSO, custom roles and permissions, continuous monitoring, a centralized guardrail dashboard, remediation recommendations and priority support with SLAs, at custom pricing. For watsonx.ai, the practical difference is who can run and review tests across a organization. The Community edition works well for an individual engineer or a single CI pipeline. Enterprise becomes relevant when several teams need shared results, governed access to the watsonx.ai credentials used in tests, and a record of changes over time. Enterprise On-Premise runs that functionality on your own infrastructure with complete data isolation and a dedicated deployment engineer. Ask the vendor for a quote based on your team structure.

How long does a first watsonx.ai integration take?

No duration is fixed here, because the time depends on the inputs your team has ready. The main drivers are which watsonx.ai models and regions your account can reach, how credentials are issued and stored, whether you are moving existing IBM BAM configurations, and how many applications and test suites need coverage. A first integration that only runs a few text or chat models against a clear set of prompts is short compared with a suite that covers several regions, CI pipelines and red teaming. Agree the scope in writing, then confirm the timeline with the partner or your own team against that scope.

What does the work need from our team?

Plan for access and decisions more than heavy build work. You need someone who can provision or confirm watsonx.ai API access and project or space settings, a decision on which model IDs and regions your use case requires, and a secrets process for the API key used in tests. You also need the application owner to define what a good answer looks like, such as expected behavior, refusal rules and data handling limits, because those become the assertions. For IBM BAM migrations, the team must identify the existing provider configurations and the prompts they run. Confirm the exact access model with IBM and your security team before work begins.

Can our engineers set up watsonx.ai testing themselves?

Yes, for a basic setup. The promptfoo documentation for IBM watsonx covers text generation and chat APIs, and a small team familiar with Node.js and YAML configuration can point promptfoo at a watsonx.ai model, run a first eval and add it to a pipeline. Teams usually need outside help when the suite must cover several regions, when credentials must be handled under strict controls, when red teaming needs a defined scope and grading policy, or when the results must be reviewed by compliance. Decide early which of those apply to you, because they change the effort more than the first config does.

Does the watsonx.ai provider work the same way across every region?

No. promptfoo supports IBM watsonx.ai text generation and chat APIs, but model availability varies by region and by account. A model available in one region may not be offered in another, and your account entitlements can restrict which models you can call. Before writing the suite, list the exact model IDs and regions you need and check them in your IBM account. Keep those values in configuration rather than hard-coded in test cases, so a regional change needs only a config update.

When should we bring in a partner for watsonx.ai testing?

Bring in a partner when the testing has to meet an external review, when several applications or regions are involved, or when your team lacks time or experience to design red team scope, grading and evidence. DeployOpen plans, implements and documents open-source platforms in infrastructure you control, runs AI security testing, and prepares evidence for compliance assessments, but it does not issue audit reports or certifications. Ask any partner for a written scope, the deliverables, and the handling of your credentials and test data before you sign.

How DeployOpen scopes and delivers watsonx.ai testing

DeployOpen treats watsonx.ai testing as a written, fixed-scope piece of work: which watsonx.ai models, regions and accounts are in play, how credentials are handled, and how promptfoo runs against them. DeployOpen is a Chainscore Labs company that plans, builds, tests and documents self-hosted open-source platforms and security testing inside the client's own environment.

How we scope

  • Confirm which watsonx.ai text and chat models your team needs, and the regions and accounts where they are enabled.
  • Inventory existing IBM BAM provider configurations and list each one that must move to watsonx.ai.
  • Agree in writing how watsonx.ai credentials will be stored, rotated and scoped for the test runner.
  • Engagements are fixed-scope, with deliverables and timelines agreed before work starts.

How we build

  • Configure the promptfoo watsonx.ai provider for the chosen models, using the provider documentation as the reference.
  • Build eval suites and, where in scope, red team configurations that run against the models your team uses.
  • Test each model and region combination and record which ones return results for your account.
  • Run the same suite across models to show differences on your own data before any model is chosen.

How we hand over

  • Deliver a configuration repository with provider settings, credential handling notes and run instructions.
  • Document the migration path from each legacy BAM configuration to its watsonx.ai equivalent.
  • Provide a short runbook covering model availability checks, common errors and where to find run results.
  • Walk your engineers through the setup so they can add models and suites without DeployOpen.

How we support

  • Support is available as a retainer for model additions, regional changes and promptfoo upgrades.
  • Confirm with IBM which watsonx.ai models your account can call before relying on them in a suite.
  • Retest configurations after promptfoo or watsonx.ai changes that affect provider behavior.
  • Ongoing testing of your applications can be added to the same retainer when scope is agreed.

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.