---
title: "创建模型"
method: POST
path: "/models"
tags: ["模型管理"]
---

# 创建模型

`POST /models`

创建新的模型配置

## Request body

- InternalHandlerCreateModelRequest
  - `description` string
  - `display_name` string
  - `name` string, required
  - `parameters` GithubComTencentWeKnoraInternalTypesModelParameters, required
    - `api_key` string
    - `app_id` string — WeKnoraCloud 厂商专用凭证
    - `app_secret` string — AES-256 加密存储，实际承载上游 API Key
    - `base_url` string
    - `context_window` integer — ContextWindow is the model's total context window in tokens and MaxOutputTokens the most it emits in one response. Both are provider facts the agent cannot discover but has to act on: the context window is what decides when conversation history gets compacted, and assuming a window larger than the real one means compaction never fires and the provider rejects the request mid-conversation instead. 0 means unknown, which falls back to DefaultMaxContextTokens.
    - `custom_headers` object — CustomHeaders 允许在调用远程模型 API 时附加自定义 HTTP 请求头， 用途类似 Python OpenAI SDK 的 extra_headers 参数， 常见场景包括透传企业网关鉴权信息、追踪 ID、路由标识等。 保留字段（Authorization、api-key、Content-Type、Accept 等）会在运行期被忽略以避免破坏签名/鉴权流程。
    - `embedding_parameters` GithubComTencentWeKnoraInternalTypesEmbeddingParameters
      - `dimension` integer
      - `supports_dimension_override` boolean
      - `truncate_prompt_tokens` integer
    - `extra_config` object — Provider-specific configuration
    - `interface_type` string
    - `max_concurrency` integer — MaxConcurrency caps concurrent in-flight BACKGROUND (ingestion / enrichment) calls to THIS specific model, keyed by model ID and shared across all replicas. 0 (the default) means "fall back to the process-wide model.max_concurrency". Interactive user-facing calls are never gated. Only chat / vlm / embedding honour this (see limiter.Gate).
    - `max_output_tokens` integer
    - `parameter_size` string — Ollama model parameter size (e.g., "7B", "13B", "70B")
    - `provider` string — Provider identifier: openai, aliyun, zhipu, generic
    - `supports_vision` boolean — Whether the model accepts image/multimodal input
  - `source` 'local' | 'remote' | 'aliyun' | 'zhipu' | 'volcengine' | 'deepseek' | 'hunyuan' | 'minimax' | 'openai' | 'gemini' | 'mimo' | 'siliconflow' | 'jina' | 'openrouter' | 'litellm' | 'requesty' | 'nvidia' | 'novita' | 'azure_openai', required
  - `type` 'Embedding' | 'Rerank' | 'KnowledgeQA' | 'VLLM' | 'ASR', required

## Response `201`

创建的模型

- object

## Other responses

- `400` — 请求参数错误

## Changes

- **2025-12-22** `e625bcd5b8b9` — 1 info
  - the endpoint scheme security `ApiKeyAuth` was added to the API
- **2025-12-16** `edf61e68559d` — 1 info
  - the endpoint scheme security `ApiKeyAuth` was removed from the API

[Change history](https://skmtc.dev/tencentblueking/apis/weknora-api/changes/models/post.md)

---

[API](https://skmtc.dev/tencentblueking/apis/weknora-api.md) · [All operations](https://skmtc.dev/tencentblueking/apis/weknora-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/tencentblueking/weknora-api/revisions/794821c045c7/schema)
