Skip to main content

1.Model Introduction

GPT-OSS is an advanced large language model developed by OpenAI designed for power reasoning, agentic tasks, and versatile developer use cases. It has versions with two model sizes.
  • gpt-oss-120b — for production, general purpose, high reasoning use cases that fit into a single 80GB GPU (like NVIDIA H100 80GB or AMD MI300X 192GB) (117B parameters with 5.1B active parameters)
  • gpt-oss-20b — for lower latency, and local or specialized use cases (21B parameters with 3.6B active parameters)
GPT-OSS introduces several groundbreaking innovations:
  • Configurable reasoning effort: Easily adjust the reasoning effort (low, medium, high) based on your specific use case and latency needs.
  • Full chain-of-thought: Gain complete access to the model’s reasoning process, facilitating easier debugging and increased trust in outputs. It’s not intended to be shown to end users.
  • Fine-tunable: Fully customize models to your specific use case through parameter fine-tuning.
  • Agentic capabilities: Use the models’ native capabilities for function calling, web browsing, Python code execution, and Structured Outputs.
  • MXFP4 quantization: The models were post-trained with MXFP4 quantization of the MoE weights, making gpt-oss-120b run on a single 80GB GPU (like NVIDIA H100 80GB or AMD MI300X 192GB) and the gpt-oss-20b model run within 16GB of memory. All evals were performed with the same MXFP4 quantization.

2.SGLang Installation

SGLang offers multiple installation methods. You can choose the most suitable installation method based on your hardware platform and requirements. Please refer to the official SGLang installation guide for installation instructions. For SGLang CPU installation, please refer to the CPU version installation guide.

3.Model Deployment

This section provides deployment configurations optimized for different hardware platforms and use cases.

3.1 Basic Configuration

The GPT-OSS series comes in two sizes. Recommended starting configurations vary depending on hardware. Interactive Command Generator: Use the configuration selector below to automatically generate the appropriate deployment command for your hardware platform, model size, quantization method, and thinking capabilities.

3.2 Configuration Tips

  • Native web search: Set EXA_API_KEY in the SGLang server environment to enable built-in web search (Exa). No --tool-server is required, and requests are tagged with x-exa-integration: sglang.
  • Web search defaults: numResults=10, search type="auto", and contents.highlights=true. Override with SGLANG_EXA_NUM_RESULTS, SGLANG_EXA_SEARCH_TYPE, and SGLANG_EXA_INCLUDE_HIGHLIGHTS.
  • Python tool: Add --tool-server demo to enable the Python interpreter. Runs in a Docker sandbox by default; set PYTHON_EXECUTION_BACKEND=UV to run on the host (model-generated code executes locally — use with care).
  • MCP tool servers: For production, point SGLang at external MCP SSE servers with --tool-server ip-1:port-1,ip-2:port-2.
  • Responses API: GPT-OSS supports OpenAI’s Responses API (client.responses.create) in addition to the standard Chat Completions API (see section 4.2.4).
  • Use Python 3.12 when running the demo Python tool.
  • Xeon CPU service configuration: Please refer to the Notes part in the serving engine launching section in the SGLang CPU server document to better understand how to configure the arguments, especially for TP (tensor parallel) and NUMA binding settings.

4.Model Invocation

4.1 Basic Usage

For basic API usage and request examples, please refer to:

4.2 Advanced Usage

4.2.1 Reasoning Parser

GPT-OSS supports reasoning mode. Enable the reasoning parser during deployment to separate the thinking and content sections:
Command
Example
Output Example:
Output

4.2.2 Tool Calling

GPT-OSS supports tool calling capabilities. Enable the tool call parser: Python Example (without Thinking Process): Start sglang server:
Command
Example
Output Example:
Output
Python Example (with Thinking Process): Start sglang server:
Command
Example
Output Example:
Output
Note:
  • The reasoning parser shows how the model decides to use a tool
  • Tool calls are clearly marked with the function name and arguments
  • You can then execute the function and send the result back to continue the conversation
Handling Tool Call Results:
Example

4.2.3 EAGLE3 Speculative Decoding

SGLang supports speculative decoding for GPT-OSS models using the EAGLE3 algorithm. This can significantly improve decoding speed, especially for small batch sizes.
Command
The spec-v2 overlap scheduler is enabled by default. It improves performance by overlapping draft and verification stages. Pass --disable-overlap-schedule to disable.

4.2.4 Responses API and Built-in Tools

GPT-OSS supports the OpenAI Responses API with built-in tool use (web search and Python interpreter). Set EXA_API_KEY to enable native web search; add --tool-server demo only when you also want the Python tool:
Command
For production, use external MCP SSE servers instead of demo:
Command
Example using Responses API:
Example

5.Benchmark

5.1 Speed Benchmark

  • Hardware: NVIDIA B200 GPU (8x)
  • Tensor Parallelism: 8
  • Model: openai/gpt-oss-120b
  • sglang version: 0.5.6
We use SGLang’s built-in benchmarking tool to conduct performance evaluation on the ShareGPT_Vicuna_unfiltered dataset. This dataset contains real conversation data and can better reflect performance in actual use scenarios.

5.1.1 Latency-Sensitive Benchmark

  • Server Command:
Command
  • Test Command:
Command
  • Test Results:
Output

5.1.2 Throughput-Sensitive Benchmark

  • Server Command:
Command
  • Test Command:
Command
Test Results:
Output

5.2 Accuracy Benchmark

5.2.1 GSM8K Benchmark

  • Benchmark Command:
Command
  • Results:
    • GPT-OSS-120b
      Output
    • GPT-OSS-20b
      Output