> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cerasai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Use CerasAI with Pi

> Connect Pi directly to CerasAI through the OpenAI Chat Completions API.

## Before you begin

Install Pi CLI, create a key on the
[API Keys](https://console.cerasai.cloud/keys) page, and choose a model on the
[Models](https://console.cerasai.cloud/models) page.

**1. Set your API key**

Export your key:

```bash theme={"system"}
export CERASAI_API_KEY="your-key"
```

**2. Configure CerasAI**

The configuration uses `deepseek-ai/DeepSeek-V4.1-Flash-1017` as an example.

Add to `~/.pi/agent/models.json`. Keep existing providers and set the token
limits to match your model.

> [accordion] Pi configuration
>
> ```json ~/.pi/agent/models.json theme={"system"}
> {
>   "providers": {
>     "cerasai": {
>       "baseUrl": "https://api.cerasai.cloud/v1",
>       "api": "openai-completions",
>       "apiKey": "$CERASAI_API_KEY",
>       "models": [
>         {
>           "id": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
>           "name": "deepseek-ai/DeepSeek-V4.1-Flash-1017",
>           "reasoning": true,
>           "contextWindow": 1048576,
>           "maxTokens": 393216,
>           "thinkingLevelMap": {
>             "minimal": null,
>             "low": "low",
>             "medium": null,
>             "high": "high",
>             "xhigh": null,
>             "max": "max"
>           },
>           "compat": {
>             "thinkingFormat": "deepseek",
>             "supportsReasoningEffort": true,
>             "maxTokensField": "max_tokens"
>           }
>         }
>       ]
>     }
>   }
> }
> ```

`"thinkingFormat": "deepseek"` makes `--thinking off` send `thinking: {"type": "disabled"}`. Without it, Pi sends
no thinking field when thinking is off, and the model thinks at its default effort `high`.

To add another model or tier, copy the entry in `providers.cerasai.models`.
Set `id` and `name` to the ID from the [model catalog](https://console.cerasai.cloud/models),
and adjust `contextWindow` and `maxTokens` to match the model. Reopen Pi to load the changes.

**3. Start a conversation**

Run the following command:

```bash theme={"system"}
pi --provider cerasai --model deepseek-ai/DeepSeek-V4.1-Flash-1017 --thinking high
```

## Model and reasoning effort

* **Model and tier:** Use `/model` to switch in the current conversation.
* **Reasoning effort:** Open `/settings` and select **low**, **high**, or **max**.

Issues common to every agent are listed under [Common issues](https://docs.cerasai.com/agent-integrations#common-issues).

## Resources

* [Pi documentation](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent)
* [CerasAI models](https://console.cerasai.cloud/models)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.