# Pi: No API key found for the selected model.

> Pi has no credential for the provider of the model it's about to use: no /login entry and no provider API key in the environment. The exact message, why Pi prints it, and the fix.

_Updated November 23, 2026 · Checked against Pi coding agent 0.8x (2026)., reproduced in EnvHaven 1.9.0_

## The message

```text
No API key found for the selected model.
```

## What it means

Pi has no credential for the provider of the model it's about to use: no /login entry and no provider API key in the environment. When it can't tell which provider the model belongs to it says 'the selected model'; otherwise it names the provider, as in 'No API key found for openai-codex'.

## Fix

1. Start `pi` and run /login to sign in to a provider via OAuth or API key.
2. Or export the provider's API key in the shell that starts pi; Pi's providers documentation (docs/providers.md) lists the variable for each provider.
3. Pick a model whose provider you have credentials for.

## In an EnvHaven workspace

Yes, until Pi is signed in once. Sign in once from the workspace's Launch menu (Sign in, or Set key for an API key); the sign-in stays on the workspace, across restarts and on every device.

## Where this comes from

This message was produced by Pi (Pi coding agent 0.8x (2026).) itself, in a throwaway EnvHaven 1.9.0 container, on 2026-11-23; the text above is copied from that output.

## Keep reading

- [Pi](https://envhaven.com/agents/pi)
- [Is Pi down?](https://envhaven.com/status/pi)
- [Every agent error](https://envhaven.com/errors)

Source: https://envhaven.com/errors/pi/no-api-key-found
