kilocode icon indicating copy to clipboard operation
kilocode copied to clipboard

[Bug]: catalog priority/fast modes send serviceTier (camelCase) to OpenAI-compatible providers

Open whiteworthy opened this issue 2 weeks ago • 1 comments

Disclosure: I run AbliteratedLLM, one of the affected providers.

Component

CLI / TUI. The code is shared, so the VS Code extension is probably affected too; I haven't tested it.

Description

For an @ai-sdk/openai-compatible provider, the catalog's -priority / -fast model entries (models.dev experimental.modes.<mode>.provider.body) send their body fields in camelCase. The upstream API never sees service_tier, so the request runs at the standard tier. Kilo still shows the mode's higher cost.

modeOptions in packages/opencode/src/provider/provider.ts (line 1415 on main) converts every body key to camelCase (service_tier → serviceTier) and returns it as model options. That only works for @ai-sdk/openai, which maps serviceTier back to service_tier. @ai-sdk/openai-compatible passes provider options it doesn't recognise into the request body unchanged, so the wire request contains "serviceTier": "priority".

Captured request body for abliteratedllm/glm-5.3-flash-priority (catalog body { service_tier = "priority" }), with messages and tools removed:

{"model":"glm-5.3-flash","max_tokens":32000,"serviceTier":"priority","tool_choice":"auto","stream":true,"stream_options":{"include_usage":true}}

Against the real API the request succeeds, because the unknown field is ignored, and it is billed at the standard price. A strict OpenAI-compatible server would reject it with 400 instead.

The same catalog shape (@ai-sdk/openai-compatible plus a mode body with service_tier) is used by fireworks-ai (16 models), databricks (15), abliteratedllm (9), orcarouter and superbot-gg in https://models.dev/api.json. I've only reproduced it with abliteratedllm; the others are inferred from the code path.

The snake_case keys need to reach the body for non-OpenAI SDKs. For example, modeOptions could camelCase keys only when model.api.npm === "@ai-sdk/openai" and pass the body through unchanged otherwise. Upstream opencode had a similar camelCase-to-compatible-provider bug for catalog variants (anomalyco/opencode#41971, closed).

Plugins

None

Kilo version

7.8.27 (@kilocode/cli from npm). The code above is unchanged on main at 85eb887.

Steps to reproduce

  1. Start a local server that logs request bodies and answers 400. Any small HTTP server will do.
  2. In an empty directory with fresh XDG_* dirs, create kilo.json that points the catalog provider at it: {"provider":{"abliteratedllm":{"options":{"baseURL":"http://127.0.0.1:18765/v1"}}}}
  3. ABLITERATEDLLM_API_KEY=dummy kilo run -m abliteratedllm/glm-5.3-flash-priority "hi"
  4. The logged body has "serviceTier":"priority" and no service_tier.

Screenshot and/or share link

Not applicable. The captured body is above.

Operating System

Windows 11

Terminal

Git Bash

This report was prepared by an AI agent on my behalf.

whiteworthy avatar Nov 14 '26 22:11 whiteworthy

I can reproduce this on 85eb887: modeOptions() camel-cases every catalog mode body key, so @ai-sdk/openai-compatible providers send serviceTier instead of service_tier. Working on a fix with a test.

rome-xi avatar Nov 15 '26 01:11 rome-xi