# Hybrid Models

Hybrid models are only available to approved customers.

`hybrid-1` is a gate model with a synthesizer that routes easy tasks to a cheap worker (Beta model) to save on total costs where subtasks are easy. Unlike a static model router, it works within the flow. Unlike a task difficulty classifier, it predicts whether Beta's completion actually matches what Alpha was going for. You can call it like any single model.

## How it works

The alpha model leads. The **gate** decides which steps go to the beta model; the **synthesis** condenses the beta model's steps for the alpha model.

## Usage

```python
from openai import OpenAI

client = OpenAI(base_url="https://api.thetokencompany.com/v1", api_key="ttc-...")

response = client.chat.completions.create(
    model="hybrid-1/glm-5.3+glm-5.3-flash",
    messages=messages,
    tools=tools,
)
```

Model name: `hybrid-1` (version) / `glm-5.3` (alpha model) + `glm-5.3-flash` (beta model). The alpha model must cost more than the beta model; `GET /v1/hybrid/models` lists the models and which slot each can fill.

We recommend pairing models from the same family for Alpha and Beta (for example `glm-5.3` with `glm-5.3-flash`) for the best results.

## Parallel runs

Each agent run is a session. Send an `x-hybrid-session` header with a unique ID per run, and the same ID on every request of that run. Without it, parallel runs still work independently, but a retried first request can't be told apart from a new run, so it runs and is billed again.

```python
import uuid

run_id = str(uuid.uuid4())  # one per agent run

response = client.chat.completions.create(
    model="hybrid-1/glm-5.3+glm-5.3-flash",
    messages=messages,
    tools=tools,
    extra_headers={"x-hybrid-session": run_id},
)
```

## Response

A standard chat completion plus an `x_hybrid` field: which model answered (`served_by`, `model`) and what this request cost in USD, split by alpha and beta model. Usage stays standard OpenAI token counts.

## Pricing

You pay list prices with no markup: input tokens for each model that reads your request, and output tokens only for the model whose answer you get. The gate and synthesis are free.

`x_hybrid.cost.usd` is the total for the request, and `x_hybrid.cost.by_role` shows how it splits between the Alpha and Beta models. When Alpha takes over from a Beta draft, both appear: Beta for reading your request, Alpha for reading it and writing the answer.