zed-industries/zed · error · anyhow::Error

OpenRouter does not support custom tools

Error message

OpenRouter does not support custom tools

What it means

OpenRouter request conversion rejects LanguageModelRequests containing custom tool inputs because the provider path only maps function-style tools; any request carrying a custom tool input fails before it reaches the API.

Source

Thrown at crates/language_models/src/provider/open_router.rs:421

    fn max_token_count(&self) -> u64 {
        self.model.max_token_count()
    }

    fn max_output_tokens(&self) -> Option<u64> {
        self.model.max_output_tokens()
    }

    fn supports_tool_choice(&self, choice: LanguageModelToolChoice) -> bool {
        match choice {
            LanguageModelToolChoice::Auto => true,
            LanguageModelToolChoice::Any => true,
            LanguageModelToolChoice::None => true,
        }
    }

    fn supports_images(&self) -> bool {
        self.model.supports_images.unwrap_or(false)
    }

    fn stream_completion(
        &self,
        request: LanguageModelRequest,
        cx: &AsyncApp,
    ) -> BoxFuture<
        'static,
        Result<
            futures::stream::BoxStream<
                'static,
                Result<LanguageModelCompletionEvent, LanguageModelCompletionError>,
            >,
            LanguageModelCompletionError,
        >,
    > {
        let openrouter_request =
            match into_open_router(request, &self.model, self.max_output_tokens()) {
                Ok(request) => request,

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Use JSON-schema tools instead of custom tools with OpenRouter models
  2. Choose a provider that supports custom tool input
  3. Strip the custom tool call/results from the request before conversion
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/language_models/src/provider/open_router.rs:424 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20). Data as JSON: /api/errors/693e10547c327d66. Report an issue: GitHub.