#2242·openclaude

Generalize store stripping for OpenAI-compat routes with Anthropic backends (stop the per-host whack-a-mole)

Author: DarkcastCreated Sep 28, 2026Updated Sep 28, 2026

Summary Expose request-body-field stripping (e.g. store) as user config, or infer it for claude-/anthropic models on an OpenAI-compatible route — instead of adding another hardcoded per-host strip.

Problem Custom OpenAI-compatible route (OPENAI_API_FORMAT=chat_completions) pointing at a LiteLLM proxy with an Anthropic backend. Every request 400s: litellm.UnsupportedParamsError: anthropic does not support parameters: ['store'], for model=sonnet-4-6 OpenClaude always sets store:false in the chat-completions body. LiteLLM forwards store to Anthropic, which rejects the param outright.

This is a recurring pattern, fixed reactively per-host

  • #1023 → #1040 — strip store when baseUrl points at Cerebras
  • #1047 — strip store when baseUrl points at Mistral
  • #2042 → #2044 — cache-probe sent store/prompt_cache_key to compat endpoints; fixed by whitelisting direct OpenAI/Azure only

Each fix hardcodes one more host. A LiteLLM proxy on a custom domain (mine: a self-hosted gateway) matches none of them, so it breaks again. store is fundamentally unsupported by Anthropic regardless of which host fronts it.

Why there's no config workaround today (v0.31.0) removeBodyFields (what strips store for deepseek/kimi/moonshot/mimo/zai and the Cerebras/Mistral host rules) is set only via:

  1. built-in provider presets, and
  2. inferRemoteModelOpenAIShimConfig, keyed on model-name prefix (deepseek/kimi/moonshot/mimo-v2).

A claude-* model on a generic openai profile matches neither. removeBodyFields is not exposed in settings.json, the provider profile, or any env var; CLAUDE_CODE_EXTRA_BODY only adds fields. So the only fix is patching dist/cli.mjs — the chat-completions body builder still emits store:!1 unconditionally (for(let field of shimConfig.removeBodyFields??[])delete body[field] never sees "store" for this route).

Proposed direction (any one ends the whack-a-mole)

  1. Expose removeBodyFields (or a transportConfig.openaiShim override) in the provider profile / settings.json, merged into the resolved shim config.
  2. Env var, e.g. OPENAI_REMOVE_BODY_FIELDS=store,stream_options.
  3. Infer removeBodyFields:["store"] when the model name is claude-* / anthropic* on an OpenAI-compat route — Anthropic never accepts store, so this is safe and host-independent.

Verified — same proxy, same model: POST /v1/chat/completions {"model":"sonnet-4-6","store":false,...} → 400 (UnsupportedParamsError: 'store') POST /v1/chat/completions {"model":"sonnet-4-6",...} → 200 OK

Env: OpenClaude v0.31.0, OPENAI_API_FORMAT=chat_completions, custom base URL → LiteLLM → Anthropic.