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

Open
opened 2026-02-16 17:34:41 -05:00 by yindo · 17 comments
Owner

Originally created by @tnthi115 on GitHub (Oct 21, 2025).

Originally assigned to: @rekram1-node on GitHub.

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

Originally created by @tnthi115 on GitHub (Oct 21, 2025). Originally assigned to: @rekram1-node on GitHub. ### 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
yindo added the bug label 2026-02-16 17:34:41 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 21, 2025):

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

  • #3044: Similar Azure GPT-5 Codex error with tool calling after several minutes of usage
  • #2915: LiteLLM tool calling error with Anthropic models requiring tools parameter
  • #3245: MCP server tool validation error with similar tools.name pattern matching issues
  • #210: Tool usage failures with OpenAI compatible providers despite working fine with direct subscriptions

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

@github-actions[bot] commented on GitHub (Oct 21, 2025): This issue might be a duplicate of existing issues. Please check: - #3044: Similar Azure GPT-5 Codex error with tool calling after several minutes of usage - #2915: LiteLLM tool calling error with Anthropic models requiring tools parameter - #3245: MCP server tool validation error with similar tools.name pattern matching issues - #210: Tool usage failures with OpenAI compatible providers despite working fine with direct subscriptions Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Oct 21, 2025):

Are you using any mcp servers?

@rekram1-node commented on GitHub (Oct 21, 2025): Are you using any mcp servers?
Author
Owner

@tnthi115 commented on GitHub (Oct 21, 2025):

Are you using any mcp servers?

Yes

@tnthi115 commented on GitHub (Oct 21, 2025): > Are you using any mcp servers? Yes
Author
Owner

@rekram1-node commented on GitHub (Oct 21, 2025):

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

@rekram1-node commented on GitHub (Oct 21, 2025): @tnthi115 what happens if u remove them does it work without them?
Author
Owner

@tnthi115 commented on GitHub (Oct 21, 2025):

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

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

@tnthi115 commented on GitHub (Oct 21, 2025): > [@tnthi115](https://github.com/tnthi115) what happens if u remove them does it work without them? I commented out my mcp config, but I got the same error.
Author
Owner

@rekram1-node commented on GitHub (Oct 21, 2025):

@tnthi115 and u restarted opencode after updating the config?

@rekram1-node commented on GitHub (Oct 21, 2025): @tnthi115 and u restarted opencode after updating the config?
Author
Owner

@tnthi115 commented on GitHub (Oct 21, 2025):

@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.

@tnthi115 commented on GitHub (Oct 21, 2025): @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.
Author
Owner

@rekram1-node commented on GitHub (Oct 21, 2025):

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

@rekram1-node commented on GitHub (Oct 21, 2025): So what;s your setup is this a custom provider -> litellm -> azure?
Author
Owner

@tnthi115 commented on GitHub (Oct 22, 2025):

Yes, litellm gateway and azure openai instance. I also have the same error as https://github.com/sst/opencode/issues/2387 and the same setup as one of the ones mentioned in that issue.

@tnthi115 commented on GitHub (Oct 22, 2025): Yes, litellm gateway and azure openai instance. I also have the same error as https://github.com/sst/opencode/issues/2387 and the same setup as one of the ones mentioned in that issue.
Author
Owner

@rekram1-node commented on GitHub (Oct 24, 2025):

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

@rekram1-node commented on GitHub (Oct 24, 2025): I can't view that link you sent, is it relevant to debugging? Can u maybe provide a screenshot or something
Author
Owner

@tnthi115 commented on GitHub (Oct 24, 2025):

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

@tnthi115 commented on GitHub (Oct 24, 2025): @rekram1-node Sorry, posted the wrong link. I just updated it
Author
Owner

@rekram1-node commented on GitHub (Oct 26, 2025):

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

@rekram1-node commented on GitHub (Oct 26, 2025): 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
Author
Owner

@rekram1-node commented on GitHub (Oct 28, 2025):

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

@rekram1-node commented on GitHub (Oct 28, 2025): does this happen on every request or is it only on compacts
Author
Owner

@beng90 commented on GitHub (Oct 30, 2025):

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

@beng90 commented on GitHub (Oct 30, 2025): I have the same issue. It works when I turn off all Tools in Continue configuration or remove "tool_use" from model config
Author
Owner

@rekram1-node commented on GitHub (Oct 30, 2025):

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

@rekram1-node commented on GitHub (Oct 30, 2025): 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
Author
Owner

@theepicsaxguy commented on GitHub (Dec 2, 2025):

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

@theepicsaxguy commented on GitHub (Dec 2, 2025): 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
Author
Owner

@mrakblt commented on GitHub (Dec 21, 2025):

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":
        ...
    }
]
...
@mrakblt commented on GitHub (Dec 21, 2025): 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": ... } ] ... ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2214