Skip to content

AI_APICallError: litellm.BadRequestError: AzureException BadRequestError - { "error": { "message": "Missing required parameter: 'tools[0].name'.", ... #3334

Closed as not planned

Description

@tnthi115

Description

My config:

  "provider": {
    "myprovider": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "myprovider",
      "options": {
        "baseURL": "myproviderapi.example.com/v1",
        "apiKey": "{env:myproviderGPT_OPENAI_API_KEY}",
      },
      "models": {
        "gpt-5": {
          "name": "gpt-5",
        },
        "gpt-5-mini": {
          "name": "gpt-5-mini",
        },
        "gpt-5-codex": {
          "name": "gpt-5-codex",
        },
        "gpt-5-nano": {
          "name": "gpt-5-nano",
        },
        "gpt-4.1": {
          "name": "gpt-4.1",
        },
        "gpt-4.1-mini": {
          "name": "gpt-4.1-mini",
        },
        "gpt-4o": {
          "name": "gpt-4o",
        },
        "gpt-4o-mini": {
          "name": "gpt-4o-mini",
        },
        "o4-mini": {
          "name": "o4-mini",
        },
        "o3": {
          "name": "o3",
        },
        "o3-mini": {
          "name": "o3-mini",
        },
        "o1": {
          "name": "o1",
        },
      },
    },
  },

When trying to use myprovider/gpt-5-codex, I get the following error:

AI_APICallError: litellm.BadRequestError: AzureException BadRequestError - {
  "error": {
    "message": "Missing required parameter: 'tools[0].name'.",
    "type": "invalid_request_error",
    "param": "tools[0].name",
    "code": "missing_required_parameter"
  }
}. Received Model Group=gpt-5-codex
Available Model Group Fallbacks=None

OpenCode version

v0.15.8

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

macOS 15.6.1

Terminal

Ghostty

Activity

  1. github-actions commented on Oct 21, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  2. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Contributor

    Are you using any mcp servers?

  3. tnthi115 commented on Oct 21, 2025

    @tnthi115
    Author

    Are you using any mcp servers?

    Yes

  4. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Contributor

    @tnthi115 what happens if u remove them does it work without them?

  5. tnthi115 commented on Oct 21, 2025

    @tnthi115
    Author

    @tnthi115 what happens if u remove them does it work without them?

    I commented out my mcp config, but I got the same error.

  6. rekram1-node commented on Oct 21, 2025

    @rekram1-node
    Contributor

    @tnthi115 and u restarted opencode after updating the config?

  7. tnthi115 commented on Oct 21, 2025

    @tnthi115
    Author

    @rekram1-node Yes I restarted it after updating the config. To confirm, I even asked a working model to use an the gitlab mcp server and it didn't work.

  8. self-assigned this
    on Oct 22, 2025
  9. rekram1-node commented on Oct 22, 2025

    @rekram1-node
    Contributor

    So what;s your setup is this a custom provider -> litellm -> azure?

  10. tnthi115 commented on Oct 22, 2025

    @tnthi115
    Author

    Yes, litellm gateway and azure openai instance. I also have the same error as #2387 and the same setup as one of the ones mentioned in that issue.

  11. rekram1-node commented on Oct 24, 2025

    @rekram1-node
    Contributor

    I can't view that link you sent, is it relevant to debugging? Can u maybe provide a screenshot or something

  12. tnthi115 commented on Oct 24, 2025

    @tnthi115
    Author

    @rekram1-node Sorry, posted the wrong link. I just updated it

  13. rekram1-node commented on Oct 26, 2025

    @rekram1-node
    Contributor

    And do you have any custom tools? I haven't seen anyone else have this issue with litellm so I tend to think it is specific to your setup

  14. rekram1-node commented on Oct 28, 2025

    @rekram1-node
    Contributor

    does this happen on every request or is it only on compacts

  15. beng90 commented on Oct 30, 2025

    @beng90

    I have the same issue. It works when I turn off all Tools in Continue configuration or remove "tool_use" from model config

  16. rekram1-node commented on Oct 30, 2025

    @rekram1-node
    Contributor

    Can either of you try this:

    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "myprovider": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "myprovider",
          "options": {
            // "baseURL": "myproviderapi.example.com/v1"
            // Go to webhook.site and paste your unique url here:
            "baseURL": ""
            // comment out to avoid leaking secrets (or delete to be safe)
            // "apiKey": "{env:myproviderGPT_OPENAI_API_KEY}"
          },
          "models": {
            "gpt-5": {
              "name": "gpt-5"
            },
            .... 
          }
        }
      }
    }
    

    If you set the url to this proxy, then open opencode, send a message to any model under that provider, then go to the webhook site, grab the request body that is NOT for title gen (so the rlly big one with tools) and then show it here, it should help me answer which tool / thing is causing the issue

  17. theepicsaxguy commented on Dec 2, 2025

    @theepicsaxguy

    I encounter the exact same issue with azure in litellm. This seems to happens only when tagging a file.

    The webhooks shows all functions has names.

    However I notice this seems to be working with gpt-5.1 but not for gpt-5.1-codex

  18. mrakblt commented on Dec 21, 2025

    @mrakblt

    I'm experiencing a similar problem. My setup is as follows:
    OpenCode -> Remote Litellm -> Azure
    I added a proxy like this and logged the requests:
    OpenCode -> local proxy -> Remote Litellm -> Azure

    I don't have access to Remote Litellm and I don't know which setting is causing this, but I've identified the source of my problem, and I'm sharing it in case we have similar issues.

    OpenCode calls tools according to the /chat/completion API, but Azure expects tool calls in the /responses API format.

    /chat/completions api request body example (Source: https://platform.openai.com/docs/api-reference/chat/create)

    ...
    "tools": [
        {
            "type": "function",
            "function": {
                "name": "bash",
                "description":
                ...
            }
        }
    ]
    ...
    

    /responses api request body example (Source: https://platform.openai.com/docs/guides/function-calling#function-tool-example)

    ...
    "tools": [
        {
            "type": "function",
            "name": "bash",
            "description":
            ...
        }
    ]
    ...
    
  19. LouisLoyer commented on Mar 11, 2026

    @LouisLoyer

    I encounter the exact same issue with azure in litellm.

  20. removed
    bugSomething isn't working
    on May 3, 2026
  21. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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