# Use Prime Agent with open models
URL: https://docs.munito.ai/prime-agent

[Prime Agent](https://github.com/PrimeIntellect-ai/prime-agent) runs open models on Munito AI through a custom provider that calls the OpenAI-compatible [Chat Completions API](https://docs.munito.ai/api/createChatCompletion).
Create an [API key](https://console.munito.ai/keys).
Export the key as `MUNITO_API_KEY`:

```bash
export MUNITO_API_KEY=munitoai_...
```

Add this configuration to `~/.prime/agent/models.json`:

```json
{
  "providers": {
    "munito": {
      "name": "Munito AI",
      "baseUrl": "https://api.munito.ai/inference/v1",
      "api": "openai-completions",
      "apiKey": "MUNITO_API_KEY",
      "models": [
        {
          "id": "zai-org/glm-5.3-flash",
          "name": "GLM-5.3-Flash",
          "reasoning": true,
          "contextWindow": 1048576,
          "maxTokens": 131072,
          "compat": { "sendSessionAffinityHeaders": true }
        }
      ]
    }
  }
}
```

Start Prime Agent in your project folder:

```bash
prime-agent --provider munito --model zai-org/glm-5.3-flash
```

The command `prime-agent -p --provider munito --model zai-org/glm-5.3-flash "<task>"` runs one task without the terminal UI, and prints the answer.
`apiKey` names the environment variable that holds the key, so the file holds no key.
`contextWindow` tells Prime Agent the context window of GLM-5.3-Flash, 1,048,576 tokens, so that it compacts the conversation before the window is full.
`prime-agent model list munito` lists the models of the provider.

Prime Agent sends the session ID in the header `x-session-affinity` because of `sendSessionAffinityHeaders`.
Munito AI then keeps the conversation on its prompt cache, see [Prompt caching](https://docs.munito.ai/prompt-caching).
Munito AI tested this configuration with Prime Agent 0.10.1.
See the [Prime Agent README](https://github.com/PrimeIntellect-ai/prime-agent#install) to install it.

Use a [regional host](https://docs.munito.ai/regions) to keep processing in the EU.
Replace the `baseUrl` with `https://api.eu.munito.ai/inference/v1`.

To add a model, add its ID and its `contextWindow` to `models`.
The page of each chat model in the [model catalog](https://docs.munito.ai/models) gives its model ID and its context.

## Reasoning effort [#reasoning-effort]

GLM-5.3-Flash always reasons.
`"reasoning": true` turns on the thinking levels of Prime Agent.
`--thinking high` sets the level of a run, and Prime Agent sends it as `reasoning_effort`.
Munito AI moves each level to the nearest level that the model has: `low`, `high` or `max`.
See [Reasoning models](https://docs.munito.ai/reasoning).
