Skip to content

Add reasoning.effort support to LM Studio’s /v1/chat/completions endpoint for openai/gpt‑oss‑20b #1250

Description

@lucasiscovici

🎯 Problem Statement

LM Studio currently exposes the OpenAI‑compatible /v1/chat/completions API, but it does not allow callers to request a chain of reasoning steps from the openai/gpt‑oss‑20b model.
For use cases that require transparent explanations (e.g., educational tools, debugging, safety audits), a new optional field – reasoning.effort – would be invaluable.


🔍 Desired Feature

Endpoint: POST /v1/chat/completions
Model: openai/gpt‑oss‑20b

Field Type Required? Description
reasoning.effort string ("low", "medium", "high" ) Optional Controls the depth of internal reasoning steps that the model should expose before delivering the final answer.

When reasoning.effort is present, LM Studio should return a response that includes:

  1. A textual chain of reasoning (e.g., numbered steps).
  2. The final answer.

Example Request

POST https://localhost:1234/v1/chat/completions
Content-Type: application/json

{
  "model": "openai/gpt‑oss‑20b",
  "messages": [
    {"role":"user","content":"Explain why the sky is blue."}
  ],
  "reasoning": {
    "effort": "high"
  }
}

Example Response

{
  "id": "chatcmpl-01",
  "object": "chat.completion",
  "created": 1711036800,
  "model": "openai/gpt‑oss‑20b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role":"assistant",
        "content":"1️⃣ Light from the sun enters Earth’s atmosphere.\n2️⃣ Short‑wavelength blue light is scattered by air molecules.\n3️⃣ Scattered blue light reaches our eyes from all directions.\n4️⃣ Result: the sky looks blue.",
        "reasoning": {
              "effort": "high",
              "summary": "Light from the sun enters Earth’s atmosphere.\nShort‑wavelength blue light is scattered by air molecules.\nScattered blue light reaches our eyes from all directions.\nResult: the sky looks blue."
          },
          "final_answer": "The sky appears blue because ..."
        }
      },
      "finish_reason":"stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 48,
    "total_tokens": 60
  }
}

🚧 Why It Matters

  • Flexibility: Allows developers to choose between quick answers (low) or in‑depth explanations (high).
  • Cost Management: Users can control token usage by selecting a lower effort level when budgets are tight.

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