Skip to content

Cohere models reject 'strict' parameter in tool definitions (422) #71

@rvernica

Description

@rvernica

Bug

When sending tool/function calls to Cohere models (cohere/command-r-08-2024, cohere/command-r7b-12-2024) via OpenRouter, the request fails with a 422 error:

{
  "message": "unknown field: parameter 'strict' is not a valid field. For proper usage, please refer to https://docs.cohere.com/reference/chat"
}

Cause

OpenRouter appears to forward the OpenAI-style "strict": true field in tool/function definitions to Cohere's API. Cohere's API does not recognize strict as a valid parameter and rejects the request.

Cohere has its own equivalent (strict_tools), but the strict field on individual tool definitions is OpenAI-specific and should be stripped or translated when routing to Cohere.

Steps to reproduce

  1. Send a chat completion request to cohere/command-r-08-2024 via OpenRouter
  2. Include tools with function definitions that contain "strict": true
  3. Cohere returns 422: unknown field: parameter 'strict' is not a valid field

Expected behavior

OpenRouter should strip or translate the strict parameter from tool definitions when routing to Cohere models, similar to how other provider-specific parameters are handled.

Environment

  • OpenRouter API (via OpenAI-compatible endpoint)
  • Models affected: cohere/command-r-08-2024, cohere/command-r7b-12-2024 (likely all Cohere models)
  • Client: OpenClaw gateway (sends standard OpenAI-format tool definitions)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions