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

# GoModel Pro

> GoModel Pro adds licensed prompt compression, intelligent routing, and OIDC SSO to the GoModel gateway.

## What Pro is

GoModel Pro is the commercial distribution of GoModel. It uses the same
gateway, configuration, providers, dashboard, and APIs as open-source
GoModel, with licensed extensions for prompt compression, intelligent routing,
OIDC single sign-on, and per-child quota templates.

Without a valid license, the Pro binary starts as the open-source gateway and
does not block traffic. An explicitly enabled SSO configuration is the
exception: startup fails closed when its SSO entitlement or configuration is
invalid, so an authentication boundary cannot disappear silently.

## Prompt compression

Prompt compression rewrites supported inference requests before they reach the
provider. It reduces repeated or structural context while preserving the
request's non-text structure.

It supports `POST /v1/chat/completions`, `POST /v1/messages`, and
`POST /v1/responses`. Tool-call arguments, non-text parts, and unknown JSON
fields are left intact. Responses reasoning items are always replayed
unchanged, because the Responses API can require them alongside function calls.

The default `high` policy combines line-run deduplication with normalization:

* file-read line-number gutters become a compact range header
* replayed chat-completions reasoning is removed when it is safe to do so
* known tool-result envelopes, search results, logs, JSON, and unified diffs
  use content-aware normalization
* profitable homogeneous JSON arrays and structured logs use reversible,
  self-describing encodings

The compressor is deterministic and fails open. It forwards a request
unchanged when a rewrite is below the saving threshold or would exceed its work
budget. Source code is preserved by default; enable code deduplication only
when the extra saving is worth replacing exact repeated source with references.

For a detected session, the gateway retains the exact body it previously sent
upstream and replays that prefix byte-for-byte on later turns. This protects a
provider prompt-cache prefix while allowing new messages to reference repeated
history. Use `new_messages_only` when the gateway may join a conversation whose
prefix it did not observe.

### Configure compression

| Environment variable                      | Default        | Purpose                                                                                             |
| ----------------------------------------- | -------------- | --------------------------------------------------------------------------------------------------- |
| `PRO_COMPRESSION_LEVEL`                   | `high`         | Select `none`, `low`, `medium`, or `high`. An explicit value makes the Dashboard setting read-only. |
| `PRO_COMPRESSION_SCOPE`                   | `full_history` | Use `new_messages_only` to protect pre-existing conversation history.                               |
| `PRO_COMPRESSION_EXCLUDE_MODELS`          | —              | Comma-separated requested-model globs to skip, such as `ollama/*`.                                  |
| `PRO_COMPRESSION_MIN_BLOCK_CHARS`         | `128`          | Minimum repeated line-run size under the high preset.                                               |
| `PRO_COMPRESSION_MIN_SAVINGS_TOKENS`      | `32`           | Minimum estimated net saving under the high preset.                                                 |
| `PRO_COMPRESSION_DEDUPLICATE_CODE`        | `false`        | Permit repeated source-code runs to be replaced with references.                                    |
| `PRO_COMPRESSION_NORMALIZE`               | `true`         | Enable content normalization and tool-schema stabilization.                                         |
| `PRO_COMPRESSION_COMPRESS_JSON_STRUCTURE` | high preset    | Enable reversible JSON-table encoding.                                                              |
| `PRO_COMPRESSION_COMPRESS_LOG_STRUCTURE`  | high preset    | Enable reversible structured-log encoding.                                                          |

Set `PRO_COMPRESSION_LEVEL=none` to disable compression for the whole
gateway. For one request, send:

```http theme={null}
X-GoModel-Compression: off
```

The per-request opt-out and the `none` level bypass request-body parsing, so
the request is forwarded unchanged.

### Inspect compression

Compressed responses include estimated savings and the number of replaced
duplicate blocks:

```http theme={null}
X-GoModel-Pro-Tokens-Saved: 1843
X-GoModel-Pro-Compression-Blocks: 12
```

Audit logs retain the original request and a revision for each rewriter. The
revision records its byte sizes and compression detail; the rewritten body is
also retained when `LOGGING_LOG_BODIES=true`. Prometheus metrics use the
`gomodel_pro_compression_` prefix, and the Dashboard Usage page reports Pro
savings in tokens or cost.

## Intelligent routing

Intelligent routing has two licensed extensions that compose with Core virtual
models:

* Smart tier routing classifies configured model aliases into easy and hard
  tiers before provider selection.
* Adaptive routing selects an upstream target from a virtual model's pool using
  observed latency, errors, cooldowns, target capacity, and the configured
  cost or latency objective.

Configure a tiered alias with ordinary GoModel model names. The tier targets can
be concrete models or virtual models:

```bash theme={null}
PRO_SMART_ROUTING_ROUTES='{"normal":{"easy":"normal-easy","hard":"normal-hard"}}'
```

Classification is deterministic and local. It considers explicit reasoning
requests, code and diagnostics, tools and schemas, structured output,
attachments, context size, and thread depth. A detected session can escalate
from easy to hard while its pin is active; it does not silently downgrade.

| Environment variable            | Default    | Purpose                                                                                         |
| ------------------------------- | ---------- | ----------------------------------------------------------------------------------------------- |
| `PRO_SMART_ROUTING_ENABLED`     | `true`     | Enable smart tier routing.                                                                      |
| `PRO_SMART_ROUTING_ROUTES`      | —          | JSON map from requested aliases to `easy` and `hard` models. No routes leaves the feature idle. |
| `PRO_SMART_ROUTING_THRESHOLD`   | `4`        | Score at or above this value selects the hard tier.                                             |
| `PRO_SMART_ROUTING_SESSION_TTL` | `30m`      | Sliding lifetime of an escalation-only session pin.                                             |
| `PRO_ROUTING_OBJECTIVE`         | `balanced` | Adaptive-target objective: `latency`, `cost`, or `balanced`.                                    |

Send `X-GoModel-Smart-Routing: off` to bypass classification for one request,
or `X-GoModel-Tier: easy` or `hard` to force its tier without changing the
session pin. Responses return `X-GoModel-Pro-Tier`,
`X-GoModel-Pro-Tier-Target`, and `X-GoModel-Pro-Tier-Score`. Metrics use the
`gomodel_pro_smartroute_` and `gomodel_pro_routing_` prefixes.

## OIDC single sign-on

OIDC SSO protects the Dashboard and supports Authorization Code flow with
PKCE, state and nonce validation, discovery, and signed `HttpOnly`,
`SameSite=Lax` sessions. Configure it under `extensions.sso` in the main
GoModel YAML configuration:

```yaml theme={null}
extensions:
  sso:
    enabled: true
    issuer_url: https://login.example.com
    client_id: gomodel
    client_secret: ${PRO_SSO_CLIENT_SECRET}
    redirect_url: https://gomodel.example.com/sso/callback
    session_secret: ${PRO_SSO_SESSION_SECRET}
    admin_groups: [gomodel-admins]
```

`PRO_SSO_*` environment variables override the YAML values. The redirect URL
must end in `/sso/callback` (including any configured `BASE_PATH`), and HTTPS
is required except for loopback development URLs. By default, at least one
administrator group is required; set `PRO_SSO_ALLOW_ALL_ADMINS=true` only for
an intentionally unrestricted OIDC client.

<Warning>
  SSO session revocation is process-local. Deploy SSO on exactly one active
  GoModel Pro replica until a shared session or revocation store is available.
</Warning>

Successful logins, rejected policies, and logouts are recorded as sanitized
audit events. Tokens, authorization codes, cookies, raw claims, and provider
error details are not stored.

An SSO session carries a `user_path` like a managed API key does, so the
group- and user-level model allowlists on the [Users](/docs/features/users) page
apply to requests made through it. Per-key `allowed_models` are a managed
API key setting and do not apply to SSO sessions.

## Quota templates

Per-child quota templates let one `user_path` budget definition apply
independently to each direct child path instead of one shared subtree budget.
Set `per_child: true` on a `budgets.user_paths` entry — see
[Budgets](/docs/features/budgets#dynamic-per-child-budgets) for YAML and
environment-variable examples and matching rules. Without the
`quota_templates` entitlement, `per_child: true` in configuration aborts
startup and admin API writes are rejected with 403
`quota_templates_not_entitled`.

## Licensing

Pro features are granted by an offline Ed25519-signed token in
`GOMODEL_PRO_LICENSE`. Validation requires no network access and works in
air-gapped environments. A license can independently grant `compression`,
`routing`, `sso`, and `quota_templates`.

Use the separate `gomodel-pro` distribution and its documentation for
installation, production build, and license-issuance instructions.
