# Troubleshoot BridgeAI

> Fix BridgeAI, the agent built into MockFlow Bridge: API key not set, no model selected, Azure and Bedrock settings, keys on Windows, and failed model requests.

Source: https://mockflow.com/docs/troubleshoot-bridgeai

BridgeAI is the agent built into MockFlow Bridge. Instead of an assistant app, it calls an AI provider with your own API key: OpenRouter, Azure OpenAI or Amazon Bedrock. Most problems come from a key that Bridge cannot see or a model that is not set. For setup, see [Choose the AI behind MockFlow Bridge](/docs/choose-the-ai-behind-bridge).

## Check the BridgeAI setup

Run this command to see each provider, whether its key is set and which model is in use:

```bash
mockflow-bridge bridgeai
```

## "BridgeAI needs an OpenAI-compatible provider key"

Bridge did not find an API key. Set the key for your provider in the same terminal window, then start Bridge there:

| Provider | Set |
| --- | --- |
| OpenRouter | `OPENROUTER_API_KEY` |
| Azure OpenAI | `AZURE_OPENAI_API_KEY` and `AZURE_OPENAI_ENDPOINT` |
| Amazon Bedrock | `AWS_BEARER_TOKEN_BEDROCK` and `AWS_REGION` |

On macOS or Linux:

```bash
export OPENROUTER_API_KEY="your-key"
mockflow-bridge
```

A key set with `export` lasts only until you close that terminal window. If BridgeAI worked yesterday and not today, set the key again, or add the `export` line to your `~/.zshrc` or `~/.bashrc` file so every new window has it.

## The key is set on Windows, but Bridge does not see it

On Windows, set the key with `setx`, then **close the Command Prompt window and open a new one** before you run `mockflow-bridge`. A window that was open when you ran `setx` does not see the new key.

```bash
setx OPENROUTER_API_KEY "your-key"
```

## Azure OpenAI or Amazon Bedrock is missing a setting

Both providers need a second setting besides the key:

- **Azure OpenAI** needs `AZURE_OPENAI_ENDPOINT`, the address of your Azure OpenAI resource. The model is your deployment name; set it with `mockflow-bridge bridgeai model` followed by the name.
- **Amazon Bedrock** needs `AWS_REGION`, for example `us-east-1`.

If one of them is missing, Bridge names the setting that is not set.

## "No model selected"

With OpenRouter, a default model is chosen for you. With other providers, choose one:

```bash
mockflow-bridge bridgeai model
```

Pick a model from the list, or type its name. If Bridge says it **could not list models**, type the model's id as your provider shows it.

## "The model request failed"

Mida shows **Sorry, the model request failed** followed by the provider's status code when the provider rejected the request. The most common causes:

- **401 or 403**: the API key is wrong, expired or has no access to the model. Create a new key with your provider and set it again.
- **402 or 429**: your provider account is out of credit or has hit a rate limit. Check your balance and limits with the provider.
- **404**: the model name is not available from your provider. Choose another with `mockflow-bridge bridgeai model`.

BridgeAI usage is billed by your provider on your own account, not by MockFlow.

## BridgeAI is set up, but another agent answers

If you also have an assistant app installed, Bridge may be set to use it. Switch to BridgeAI:

```bash
mockflow-bridge agent bridgeai
```

On Basic, Bridge runs on Claude Code only; BridgeAI needs Bridge Pro, included in Plus and Max.
