Skip to content

OpenAI GPT-OSS 20b ​

INFO

GPT-OSS 120b reached end of life on 12 October 2026 and is no longer available. See the end of life documentation for historical reference.

GPT-OSS 20b is a flexible open-weight reasoning model designed for developers, researchers, and enterprises who need the advanced reasoning capabilities of chain-of-thought processing to tackle their hardest problems.

The model has been trained to think step-by-step before responding with an answer, excelling at complex reasoning tasks such as coding, mathematics, planning, puzzles, and agent workflows.

It features adjustable reasoning effort levels, allowing you to balance performance with computational cost.

Benchmarks ​

Below are the findings from independent benchmark provider Artifical Analysis:

Benchmarks

Intelligence: GPT-OSS 20b scores extremely well for its size and sparsity, ranking the most intelligent for its size.

How to use our GPT-OSS 20b model ​

Since reasoning models produce longer responses with chain-of-thought processing, we recommend streaming tokens for better user experience:

python
import os
from openai import OpenAI

client = openai.OpenAI(
    api_key=os.getenv("YOUR_API_KEY"),
    base_url="https://api.swisscom.com/layer/swiss-ai-platform/gpt-oss-20b/v1",
)

stream = client.chat.completions.create(
    model="openai/gpt-oss-20b",
    messages=[
        {"role": "user", "content": "What are the first 10 prime numbers?"}
    ],
    temperature=1.0,
    reasoning_effort='medium',
    stream=True
)

for chunk in stream:
    print(chunk)
    print(chunk.choices[0].delta.content)
    print("****************")
ts
import OpenAI from "openai";
const client = new OpenAI({
  apiKey: process.env["YOUR_API_KEY"],
  baseURL: "https://api.swisscom.com/layer/swiss-ai-platform/gpt-oss-20b/v1"
});

const stream = await client.chat.completions.create({
  model: "openai/gpt-oss-20b",
  messages: [{ 
    role: "user", 
    content: "What are the first 10 prime numbers?" 
  }],
  temperature: 1.0,
  reasoning_effort: "medium",
  stream: true,
});

for await (const chunk of stream) {
  console.log(event)
}
bash
curl -X POST "https://api.swisscom.com/layer/swiss-ai-platform/gpt-oss-20b/v1/chat/completions" \
     -H "Authorization: Bearer $YOUR_API_KEY" \
     -H "Content-Type: application/json" \
     -d '{
     	"model": "openai/gpt-oss-20b",
     	"messages": [
          {
              "role": "user", 
              "content": "What are the first 10 prime numbers?"
          }
     	],
        "temperature": 1.0,
        "reasoning_effort": "medium",
        "stream": true
     }'

This will produce the response below:

json
{
  "id": "chat-abcdefg1234567",
  "object": "chat.completion.chunk",
  "created": 1743765837,
  "model": "openai/gpt-oss-20b",
  "choices": [
    {
      "index": 0,
      "delta": {
        "role": "assistant",
        "content": "Okay"
      },
      "finish_reason": null
    }
  ]
}
json
{
    "id": "chatcmpl-4e8e5b799bc44c54a434207360e6162a",
    "object": "chat.completion",
    "created": 1755594620,
    "model": "openai/gpt-oss-20b",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "The first 10 prime numbers are:\n\n1. 2  \n2. 3  \n3. 5  \n4. 7  \n5. 11  \n6. 13  \n7. 17  \n8. 19  \n9. 23  \n10. 29",
                "refusal": null,
                "annotations": null,
                "audio": null,
                "function_call": null,
                "tool_calls": [],
                "reasoning_content": "User asks: \"What are the first 10 prime numbers?\" This is straightforward. Provide answer list: 2,3,5,7,11,13,17,19,23,29. Possibly explanation. No policy issues."
            },
            "logprobs": null,
            "finish_reason": "stop",
            "stop_reason": null
        }
    ],
    "service_tier": null,
    "system_fingerprint": null,
    "usage": {
        "prompt_tokens": 80,
        "total_tokens": 197,
        "completion_tokens": 117,
        "prompt_tokens_details": null
    },
    "prompt_logprobs": null,
    "kv_transfer_params": null
}

To access just the chain-of-thought reasoning you can look at the reasoning_content property:

plain
User asks: "What are the first 10 prime numbers?" It's a straightforward factual question. Provide the list: 2,3,5,7,11,13,17,19,23,29.

We comply.

GPT-OSS Best Practices ​

Reasoning models like GPT-OSS should be used differently than standard instruct models to get optimal results:

Recommended Parameters:

  • Reasoning Effort: Use the adjustable reasoning effort levels to control computational cost vs. accuracy.
  • Temperature: Use 1.0 for maximum creativity and diverse reasoning approaches.
  • Top-p: Use 1.0 to allow the full vocabulary distribution for optimal reasoning exploration.

Prompting Best Practices:

Think of GPT-OSS as a senior problem-solver – provide high-level objectives and let it determine the methodology:

  • Strengths: Excels at open-ended reasoning, multi-step logic, and inferring unstated requirements
  • Avoid over-prompting: Micromanaging steps can limit its advanced reasoning capabilities
  • Provide clear objectives: Balance clarity with flexibility for optimal results

Limitations

tool_choice Parameter Not Supported:

The tool_choice parameter is currently not supported for the GPT-OSS 20b model. When this parameter is used, the model returns empty content and reasoning_content fields.

We are actively working on a fix to resolve this limitation.

GPT-OSS Use Cases ​

  • Code Review & Analysis: Comprehensive code analysis across large codebases with detailed improvement suggestions
  • Strategic Planning: Multi-stage planning with reasoning about optimal approaches and resource allocation
  • Complex Document Analysis: Processing legal contracts, technical specifications, and regulatory documents
  • Benchmarking AI Systems: Evaluates other LLM responses with contextual understanding, particularly useful in critical validation scenarios
  • AI Model Evaluation: Sophisticated evaluation of other AI systems with contextual understanding
  • Scientific Research: Multi-step reasoning for hypothesis generation and experimental design
  • Academic Analysis: Deep analysis of research papers and literature reviews
  • Information Extraction: Efficiently extracts relevant data from large volumes of unstructured information, ideal for RAG systems
  • Agent Workflows: Building sophisticated AI agents with complex reasoning capabilities
  • RAG Systems: Enhanced information extraction and synthesis from large knowledge bases
  • Problem Solving: Handling ambiguous requirements and inferring unstated assumptions
  • Ambiguity Resolution: Interprets unclear instructions effectively and seeks clarification when needed

Managing Context and Costs ​

Reasoning Effort Control: ​

GPT-OSS features adjustable reasoning effort levels to optimize for your specific use case:

  • Low effort: Faster responses for simpler tasks with reduced reasoning depth
  • Medium effort: Balanced performance for most use cases (recommended default)
  • High effort: Maximum reasoning for complex problems requiring deep analysis. You should also specify max_tokens of 16000 with this setting.

Token Management: ​

When working with reasoning models, it's crucial to maintain adequate space in the context window:

  • Use max_tokens parameter to control response length and costs
  • Monitor reasoning token usage vs. output tokens - reasoning tokens can vary from hundreds to tens of thousands based on complexity
  • Consider reasoning effort level based on task complexity and budget constraints
  • Simpler problems may only require a few hundred reasoning tokens, while complex challenges could generate extensive reasoning

Cost/Latency Optimization: ​

  • Implement limits on total token generation using the max_tokens parameter
  • Balance thorough reasoning with resource utilization based on your specific requirements
  • Consider using lower reasoning effort for routine tasks and higher effort for critical decisions

Technical Architecture ​

Model Architecture: ​

  • MoE Design: Token-choice Mixture-of-Experts with SwiGLU activations for improved performance
  • Expert Selection: Softmax-after-topk approach for calculating MoE weights, ensuring optimal expert utilization
  • Attention Mechanism: RoPE (Rotary Position Embedding) with 128k context length
  • Attention Patterns: Alternating between full context and sliding 128-token window for efficiency
  • Attention Sink: Learned attention sink per-head with additional additive value in the softmax denominator

Tokenization: ​

  • Standard Compatibility: Uses the same tokenizer as GPT-4o
  • Broad Support: Ensures seamless integration with existing applications and tools

Context Handling: ​

  • 128k Context Window: Large context capacity for processing extensive documents
  • Efficient Patterns: Optimized attention patterns for long-context scenarios