Skip to content

Support protocol-aware per-model extra request parameters #1674

Description

@ayu-exorcist

Problem / 背景

English

Provider APIs and compatible gateways expose useful request fields that Kimi Code does not generate itself. For example, OpenAI Priority processing uses service_tier: "priority". Without a supported configuration surface, users need a reverse proxy or a local source patch to use those capabilities.

中文

供应商 API 与兼容网关提供了 Kimi Code 不会自行生成的实用请求字段。例如,OpenAI Priority 处理需要 service_tier: "priority"。缺少受支持的配置入口时,用户只能借助反向代理或修改本地源码来使用这些能力。

Current delivery / 当前交付

English

PR #1789 delivers a provider-scoped custom_body field. It accepts a recursive JSON object, deep-merges it into provider-native requests at dispatch time, preserves native keys through configuration PATCH handling, and supports Kimi, Anthropic, OpenAI Chat Completions, OpenAI Responses, Google GenAI, and Vertex AI.

A boolean stream is a special transport-control override: it selects the corresponding streaming mode and response decoding. For Google GenAI and Vertex AI it selects the SDK method and is not forwarded as a request parameter. Unsafe object keys (__proto__, prototype, and constructor) are rejected at every nesting level.

中文

PR #1789 交付了 Provider 级 custom_body 字段。它接受递归 JSON 对象,在请求发出时深度合并到供应商原生请求中,在配置 PATCH 处理中保留原生键,并支持 Kimi、Anthropic、OpenAI Chat Completions、OpenAI Responses、Google GenAI 和 Vertex AI。

布尔值 stream 是特殊的传输控制覆盖:它会选择相应的流式模式和响应解码。对于 Google GenAI 与 Vertex AI,它选择 SDK 方法而不会作为请求参数透传。所有嵌套层级都会拒绝不安全对象键 __proto__prototypeconstructor

Remaining scope / 剩余范围

English

This issue originally asks for protocol-aware per-model extra request parameters. Provider-level configuration is now available, but model-level overrides are not implemented and should not be inferred from PR #1789.

Before adding model scope, define and review:

  • the configuration shape and whether it belongs on model aliases or model overrides;
  • precedence between provider custom_body, model overrides, generated request fields, and any runtime options;
  • protocol-specific control fields such as stream, including whether they are permitted at model scope;
  • validation, redaction, persistence, migration, and klient/API round-trip behavior.

中文

本 issue 最初要求的是具备协议感知能力的模型级额外请求参数。Provider 级配置现已可用,但模型级覆盖尚未实现,不应将 PR #1789 视为已经完成该部分。

在引入模型级范围前,需要先明确并评审:

  • 配置形态,以及它应位于模型别名还是模型覆盖项;
  • Provider custom_body、模型覆盖、生成请求字段和运行时选项之间的优先级;
  • stream 等协议特定控制字段,以及它们是否允许在模型级范围内使用;
  • 校验、脱敏、持久化、迁移与 klient/API 往返行为。

Status / 状态

Keep this issue open for the model-scoped design and implementation. Provider-scoped support is available in PR #1789.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions