# Models and keys

Dija is model-agnostic: your workspace chooses which AI models Dija runs on, using your company's own provider account and API keys. Only the workspace owner configures models on **Connections** under **Models**, while everyone on the team can view which models are active.

## Main model vs. Decision model

- **Main model (required):** Powers chat replies, runs background jobs, and drafts all text. Because Dija cannot respond without one, choosing a **Main model** is the one required step during workspace setup.
- **Decision model (optional):** Handles fast, structured routing and yes-or-no checks, such as confirming whether a teammate's reply approves a read-back or matching an incoming tool webhook to the right skill. If you leave it unset, the **Main model** handles those checks too.

## Supported providers

| Provider                                                    | Roles supported          | Capabilities and setup notes                                                                                                                                                                                                                                                         |
| ----------------------------------------------------------- | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Anthropic** (Claude), **OpenAI** (GPT), **Google Gemini** | **Main** or **Decision** | Enables built-in web search and page reading when set as the **Main model**. Model lists update automatically from a published catalog.                                                                                                                                              |
| **OpenRouter**                                              | **Main** or **Decision** | Connects models from many providers behind one API key, updated automatically from the published catalog. As the **Main model**, Dija reads the web only through a web tool you connect.                                                                                             |
| **TypeSafe AI** (Jev), **Cloudflare** (Clef, Clef-flash)    | **Decision** only        | Purpose-built classification models that do not generate prose. Cloudflare requires your Account ID and an API token.                                                                                                                                                                |
| **Other** (OpenAI-compatible)                               | **Main** or **Decision** | Connect any public `https` OpenAI-compatible endpoint by entering its name, URL, exact model ID, and four prices per million tokens (input, cached input, cache write, and output) for cost tracking. As the **Main model**, Dija reads the web only through a web tool you connect. |

All providers connect with API keys or tokens from your developer account. You cannot sign in with a chat subscription, but some subscriptions include monthly API credits that pay for a key, so you can start Dija at no extra cost:

| Subscription | Includes API credits | Does not                      |
| ------------ | -------------------- | ----------------------------- |
| **Claude**   | Max, Ultra and Team  | Free, Pro and Enterprise      |
| **ChatGPT**  | Pro and Business     | Free, Go, Plus and Enterprise |

To use them, link an API organization to your subscription, then create a key there and enter it on **Connections**. The model step shows how for each provider, with a link to its guide. Credits expire each month, and usage beyond them is billed by the provider as usual.

## Direct billing and cost tracking

Every model call runs on your workspace's key and is billed directly by your provider with zero markup from Dija.

Dija calculates job costs from each model's listed base prices, displays them on **Jobs**, and enforces the per-job, per-person, and monthly company ceilings configured under **Settings** and **Team**, stopping after the step that reaches one, so that last step can go slightly over (see [Jobs](jobs.md)). Because some providers charge higher tier rates on very long prompts, your provider's invoice can occasionally run slightly higher than Dija's estimate and is always the final bill.

## Managing models on Connections

Open **Connections** and choose **Main model** or **Decision model** under **Models**. There, the workspace owner can:

- **Select or switch models:** Dija makes one live test call before saving and never stores a rejected key. You can switch the **Main model** anytime, though it cannot be removed.
- **Share or rotate credentials:** When **Main** and **Decision** use the same provider, you enter credentials once. You can replace a key at any time.
- **Remove the Decision model:** Routing checks fall back to the **Main model**.
- **Keep keys for several providers:** Dija keeps each provider's key when you switch away from it, so you can switch back without entering it again. To delete a key, choose its provider and click **Remove access details**. You cannot remove the key of a provider that a model currently uses.

If a provider starts rejecting a saved key, **Connections** flags the provider with a button to enter working credentials, and Dija's chat reply tells you where the owner can update it.

## How keys are protected

API keys are entered only on **Connections**, never in a conversation, and Dija never asks for a key in chat. Keys are encrypted at rest, sealed to your workspace, and decrypted only by Dija's host code at the exact moment of an API call. Because keys never enter prompts, messages, logs, or error reports, the AI model never sees your keys and cannot be prompted into revealing them. The same protection applies to every connected tool (see [Company tools and your own tools](tools.md)).
