> ## 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.

# 自定義提供方

> 註冊、列出並刪除你自己的 OpenAI 兼容模型端點(自帶模型)。

將任意 **OpenAI 兼容**的 chat-completions 端點註冊為自定義提供方,然後即可在[模型方案](/api-reference/keys/model-plan)或[編排器圖](/api-reference/keys/orchestrator-graph)的 Model 節點中,通過帶命名空間的 id `custom:<providerId>:<modelId>` 引用其模型。發往你自己模型的請求是**免費**的,不會消耗 Theo 令牌——你直接向你的提供方付費。

## 身份驗證

需要具備 `billing` 權限範圍的 API 密鑰。

## 註冊一個提供方

`POST /api/v1/custom-providers`

<ParamField body="name" type="string" required>顯示名稱(1–120 個字符)。</ParamField>
<ParamField body="base_url" type="string" required>該端點的基礎 URL——必須是 `http(s)`。</ParamField>
<ParamField body="api_key" type="string" required>提供方的 API 密鑰。以加密方式存儲;API 永遠不會返回該值。</ParamField>

<ParamField body="models" type="object[]" required>
  1–50 個模型。每個模型:`{ id, label, contextWindow? }`。

  <Expandable title="model fields">
    <ParamField body="id" type="string" required>發送給你端點的原始模型 id(1–200 個字符)。</ParamField>
    <ParamField body="label" type="string" required>顯示標籤(1–120 個字符)。</ParamField>

    <ParamField body="contextWindow" type="integer">
      可選的聲明式上下文窗口大小(以令牌計)。設置後,Theo 的上下文窗口護欄可以在超大請求發往你的端點**之前**將其攔截(並在該密鑰上存在更大模型可用時,將請求繞道路由過去)。若未知可省略——此時該模型會被視為無上限,直接放行通過護欄。
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="local" type="boolean">
  本機 / 本地部署:僅可從已關聯的桌面端訪問,永不從雲端派發。默認值為 `false`。
</ParamField>

返回 `{ id }`——即該提供方的 id。可通過 `custom:<id>:<modelId>` 引用其模型。

## 列出提供方

`GET /api/v1/custom-providers` → `{ providers: [{ id, name, base_url, models }] }`。API 密鑰永遠不會包含在返回結果中。

## 刪除一個提供方

`DELETE /api/v1/custom-providers/{id}` → `{ deleted: true }`。

## 示例

<CodeGroup>
  ```bash curl theme={null}
  curl -X POST https://www.hitheo.ai/api/v1/custom-providers \
    -H "Authorization: Bearer $THEO_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "My vLLM",
      "base_url": "https://llm.example.com/v1",
      "api_key": "sk-...",
      "models": [{ "id": "my-llama-70b", "label": "Llama 70B", "contextWindow": 131072 }]
    }'
  ```
</CodeGroup>

然後將其固定到某個密鑰上:

```ts theme={null}
await theo.keys.setModelPlan("KEY_ID", {
  single_model: { upstream_id: "custom:PROVIDER_ID:my-llama-70b" },
});
```


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