Skip to content

OpenAI OSS tool calling #1622

Closed
Closed

Description

@Syazvinski

When running through LM Studio, it seems the new template for tools that the OpenAI OSS models use is different and causes premature reasoning to end. Not sure if this is an issue for LM Studio to solve or for Opencode to support.

This is my config

        "npm": "@ai-sdk/openai-compatible",
        "options": {
          "baseURL": "url here"
        },
        "models": {
          "openai/gpt-oss-20b": {
          "name": "Local Model LM Studio",
          "tool_call": true,
          "reasoning": true,
          "limit": {
            "context": 128000,
            "output": 128000
          },
           "options": {
            "tools": true,
            "reasoning": true
          }
          }
        }
    },```

Activity

  1. cksac commented on Aug 6, 2025

    @cksac

    looks like gpt-oss is trained with https://cookbook.openai.com/articles/openai-harmony#function-calling?
    the final prompt should follow openai-harmony format to achieve better result.

  2. jgontrum commented on Aug 6, 2025

    @jgontrum

    AFAIK opencode uses AI SDK which handles the final formatting of the prompts for the used mode/provider. Wouldn’t be surprised if they release an update soon, they seem quite active

  3. Ronuhz commented on Aug 6, 2025

    @Ronuhz

    Yeah either something goes very wrong with tool calls in OpenCode or the AI SDK, or this model sucks at tool calling.

  4. self-assigned this
    on Aug 6, 2025
  5. thdxr commented on Aug 6, 2025

    @thdxr
    Member

    it's both - the model sucks at tool calling but parsing these harmony formats is up to the provider - in this case LM Studio

    i did think they pushed an update for it though?

  6. cksac commented on Aug 7, 2025

    @cksac

    harmony formats is not only about model output, which is cater by the provider.
    but also the application prompt requirements to achive best result when using gpt-oss.
    If application required tool call using XML format, it most will failed at first shot as it mostly add <|constrain|>json before message, causing the model response in json format when tool call.

    If application expect xml tool call foramt, add following to the prompt will help

    1. USE XML format for all tool calls
    2. DON'T add <|constrain|>json for tool calls
    
  7. rekram1-node commented on Dec 28, 2025

    @rekram1-node
    Contributor

    [automated] Closing due to 90+ days of inactivity. Feel free to reopen if you still need this!

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