vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Custom Endpoint (Responses API): `truncation` is always sent and cannot be omitted, breaking Kimi Code

Open lcv-leo opened this issue 2 weeks ago • 1 comments

  • VS Code: 1.146.0 (69047191fc427f2f92828279aae1d90d8eeda7ab, x64)
  • Bundled Copilot extension: 0.74.0
  • OS: Windows 11 Pro 10.0.26300

Problem

A Custom Endpoint model configured with "apiType": "responses" always sends a top-level truncation field. Kimi Code's OpenAI-compatible Responses endpoint (https://api.kimi.ai/coding/v1) rejects that field, so every chat request fails:

Reason: Failed to get response from the AI model; retried 5 times (total retry wait time: 15.94 seconds)
Last error: 502 Request Failed: 400 {"error":{"code":"invalid_request_error","message":"invalid_request_error: invalid_request_error: truncation is not supported","type":"invalid_request_error"}}

In the bundled extension the field is set unconditionally; the only related setting, chat.useResponsesApiTruncation (default false), switches the value between "disabled" and "auto" but never omits the field:

S.truncation=o.getConfig(H.Advanced.UseResponsesApiTruncation)?"auto":"disabled"

I found no chatLanguageModels.json property that removes it (modelOptions only accepts temperature and top_p).

Steps to reproduce

  1. Run Chat: Manage Language Models > Add Models > Custom Endpoint, API type Responses, with a Kimi Code API key.
  2. Use this model entry in chatLanguageModels.json:
{
  "name": "Kimi Code",
  "vendor": "customendpoint",
  "apiKey": "${input:kimiKey}",
  "apiType": "responses",
  "models": [
    {
      "id": "k3.1-pro",
      "name": "Kimi K3.1 Pro",
      "url": "https://api.kimi.ai/coding/v1",
      "toolCalling": true,
      "vision": true,
      "thinking": true,
      "statefulResponses": false,
      "supportsReasoningEffort": ["low", "high", "max"],
      "reasoningEffortFormat": "responses",
      "maxInputTokens": 917504,
      "maxOutputTokens": 131072
    }
  ]
}
  1. Select the model in chat and send any message.

Expected

A way to omit truncation for Custom Endpoint models (for example, omit it when the setting is off, or a per-model property), so OpenAI-compatible Responses servers that do not implement it can be used.

Notes

  • The same model works in VS Code with "apiType": "chat-completions".
  • GitHub Copilot CLI 1.0.112 works against the same endpoint with "wireApi": "responses"; its request body does not contain truncation.
  • Kimi documents the endpoint as Responses-compatible and recommends the Responses format for tools that support it: https://www.kimi.com/code/docs/en/kimi-code/models.html

lcv-leo avatar Nov 15 '26 19:11 lcv-leo

Kimi report: https://github.com/MoonshotAI/kimi-code/issues/4970

lcv-leo avatar Nov 15 '26 19:11 lcv-leo