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

# 記錄一次路由糾正

> 提交 playground 中的“重新路由（Reroute）”操作，幫助 Theo 瞭解全局分類器在哪裏出錯。

記錄一次路由糾正——即開發者對已解析的模式表示不認同，並提供了他們期望的模式的一次對話輪次。Theo 會為每個調用方保留最近 30 天的糾正記錄，並按 `expected_mode` 對其進行聚類；一旦某個聚類超過閾值，playground 就會顯示一條“我發現了一個規律”的提示，開發者可以據此讓 Theo [建議一條規則](/api-reference/routing-preferences/suggest-rule)，該規則由該聚類推導而來。

糾正記錄的作用域為個人或團隊級別（與調用方當前激活的組織上下文一致），因此個人的糾正記錄不會觸發團隊級別的建議提示條。

## 身份驗證

需要攜帶具備 `billing` API 密鑰作用域的 Bearer 令牌。該接口是冪等的：相同的 `Idempotency-Key` 請求頭會重放相同的響應。

## 請求體

<ParamField body="prompt" type="string" required>
  產生了非預期模式的提示詞。長度為 1–4096 個字符。會在服務層做供應商名稱脫敏處理。
</ParamField>

<ParamField body="expected_mode" type="string" required>
  開發者期望的 Theo 模式（例如 `"think"`、`"image"`、`"insurance_quote"`）。
</ParamField>

<ParamField body="source_message_id" type="string">
  可選參數，指該糾正所關聯對話輪次的消息 id。長度不超過 128 個字符。
</ParamField>

## 請求示例

```bash curl theme={null}
curl -X POST https://www.hitheo.ai/api/v1/routing-preferences/corrections \
  -H "Authorization: Bearer $THEO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Look at this indemnity clause",
    "expected_mode": "think"
  }'
```

## 響應

```json theme={null}
{
  "id": "corr_abc123",
  "ok": true,
  "cluster_threshold": 3,
  "pattern_suggestion_available": true,
  "pattern_expected_mode": "think",
  "pattern_count": 3
}
```

當 `pattern_suggestion_available` 為 `true` 時，可調用 [POST /api/v1/routing-preferences/suggest-rule](/api-reference/routing-preferences/suggest-rule)，並傳入匹配的 `expected_mode`，即可獲得一條由該聚類推導出的確定性正則表達式。

## 錯誤

* `400 routing_correction_invalid` —— 通用的請求結構校驗失敗。
* `400 routing_correction_vendor_name` —— 提示詞中提及了上游供應商名稱（如 Claude、OpenAI 等）。
* `400 routing_correction_invalid_mode` —— `expected_mode` 不是已知的 Theo 模式。


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