Skip to main content

Drop params

Not every provider supports every OpenAI parameter. By default, Spanway raises an UnsupportedParamsError when a request includes a parameter the target provider cannot handle, so that a silently ignored setting does not change behaviour without anyone noticing. In many deployments it is more practical to drop such parameters and let the call go through, especially when one application talks to several providers. Drop params is the switch for that choice, and it can be set for the whole gateway, for one deployment or for one request.

Scenario​

An internal chat tool always sends frequency_penalty and logit_bias, because it was written for OpenAI models. The platform team adds a Claude deployment behind the same public name as a fallback. Without drop params the fallback fails with an unsupported parameter error, so the team turns on drop_params on the Claude deployment. Requests now reach Claude with the two settings removed, and the tool does not need a code change.

Steps​

  1. Reproduce the error. Send a request with a parameter the provider does not support.

    curl -X POST http://localhost:4000/v1/chat/completions \
    -H "Authorization: Bearer $SPANWAY_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"model": "claude-sonnet-5-5", "messages": [{"role": "user", "content": "Hi"}], "frequency_penalty": 0.5}'
  2. Turn drop params on for the deployment. In the Admin UI open Models + Endpoints (/ui/models-and-endpoints), click the model in the Deployed Models table, click Edit on the Model Settings card and add "drop_params": true to Spanway Params, then save. In config.yaml the same setting is drop_params: true under the deployment's spanway_params.

  3. Send the request again. It succeeds, and the provider request no longer carries frequency_penalty.

  4. To drop a parameter for one request only, add "drop_params": true to the body instead. To drop it for every deployment, set spanway_settings.drop_params: true in config.yaml or the SPANWAY_DROP_PARAMS environment variable.

  5. Confirm what reached the provider. Open API Playground (/ui/transform-request), paste the body and click Transform. The provider request on the right shows the body without the dropped parameter.

Expected result​

Step 1 answers 400 with {"error": {"message": "... frequency_penalty is not supported by anthropic ...", "type": "invalid_request_error", "code": "400"}}. After step 2 the same request answers 200 with a normal chat completion, and the request log shows the call without the dropped field.

Dropping globally​

spanway_settings:
drop_params: true

The SPANWAY_DROP_PARAMS environment variable sets the same default, and the --drop_params flag of the gateway command turns it on for a gateway.

Dropping per call or per deployment​

model_list:
- model_name: claude-sonnet-5-5
spanway_params:
model: anthropic/claude-sonnet-5-5
api_key: os.environ/ANTHROPIC_API_KEY
drop_params: true

A request can also carry "drop_params": true in its body.

Dropping specific parameters​

additional_drop_params lists parameters to remove even when the provider supports them, which is useful when a client always sends a setting you do not want to reach the provider.

model_list:
- model_name: gpt-6.1-sol
spanway_params:
model: openai/gpt-6.1-sol
api_key: os.environ/OPENAI_API_KEY
additional_drop_params: ["logit_bias", "user"]

Allowing extra parameters​

The opposite case is a parameter the provider accepts but Spanway does not list as supported for that model. allowed_openai_params forwards those parameters without an error.

model_list:
- model_name: custom-vllm
spanway_params:
model: hosted_vllm/my-model
api_base: http://vllm.internal:8000/v1
allowed_openai_params: ["logit_bias"]

Errors​

StatusWhat it meansFix
400 UnsupportedParamsErrorA parameter is not supported by the provider and no drop params setting applies. The message names the parameter and the provider.Turn on drop_params at one of the three levels above, or remove the parameter.
400 after a fallbackThe primary deployment accepted the parameter but the fallback provider does not.Set drop_params: true on the fallback deployment.
A setting has no effectThe parameter is in additional_drop_params, or drop_params is on and the provider does not support it, so it was silently removed.Check the translated request in API Playground, and remove the parameter from additional_drop_params if you need it.