Back to Models

GPT OSS 20B

openaiopenai/gpt-oss-20b

API guide

Chat completion

Use standard OpenAI-compatible chat completion via TheRouter. The model uses the harmony chat format; TheRouter handles the conversion automatically.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-oss-20b",
    "messages": [
      {"role": "user", "content": "What makes Mixture-of-Experts models efficient for edge deployment?"}
    ]
  }'

Reasoning mode

Set reasoning effort via system message. Use 'Reasoning: low', 'Reasoning: medium', or 'Reasoning: high' to control CoT length and accuracy.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-oss-20b",
    "messages": [
      {"role": "system", "content": "Reasoning: low"},
      {"role": "user", "content": "Simplify this code: function factorial(n) { if (n <= 1) return 1; return n * factorial(n-1); }"}
    ]
  }'

Tool/function calling

Full support for OpenAI-compatible tool and function calling. Define functions in the standard OpenAI schema.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-oss-20b",
    "messages": [{"role": "user", "content": "What is the weather in Tokyo?"}],
    "tools": [{
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Get current weather",
        "parameters": {
          "type": "object",
          "properties": {"location": {"type": "string"}},
          "required": ["location"]
        }
      }
    }],
    "tool_choice": "auto"
  }'

Structured Outputs

GPT OSS 20B supports OpenAI Structured Outputs for guaranteed JSON responses matching a schema.

cURL
curl https://api.therouter.ai/v1/chat/completions \
  -H "Authorization: Bearer $THEROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-oss-20b",
    "messages": [{"role": "user", "content": "Extract the date, amount, and vendor from this invoice text."}],
    "response_format": {
      "type": "json_schema",
      "json_schema": {
        "name": "invoice_fields",
        "schema": {
          "type": "object",
          "properties": {
            "date": {"type": "string"},
            "amount": {"type": "number"},
            "vendor": {"type": "string"}
          },
          "required": ["date", "amount", "vendor"]
        }
      }
    }
  }'
Fact ledger β€” every claim on this page traces here
sourceURLretrieved
Release dateopenai.com β†—2026-05-29verified
Architectureopenai.com β†—2026-05-29verified
Licenseopenai.com β†—2026-05-29verified
Knowledge cutoffarxiv.org β†—2026-05-29verified
Tokenizerarxiv.org β†—2026-05-29verified
Minimum memoryopenai.com β†—2026-05-29verified
Quantizationarxiv.org β†—2026-05-29verified
Checkpoint sizehuggingface.co β†—2026-05-29verified
Reasoning modesopenai.com β†—2026-05-29verified
MMLUarxiv.org β†—2026-05-29verified
AIME 2024arxiv.org β†—2026-05-29verified
AIME 2025arxiv.org β†—2026-05-29verified
Codeforces Eloopenai.com β†—2026-05-29to verify
SWE-Bench Verifiedarxiv.org β†—2026-05-29verified
GPQA Diamondarxiv.org β†—2026-05-29verified
HLEarxiv.org β†—2026-05-29verified
HealthBencharxiv.org β†—2026-05-29verified
Tau-Bench Retailarxiv.org β†—2026-05-29verified
Can I use GPT OSS 20B through TheRouter's API without self-hosting?openai.com β†—2026-05-29to verify
What license does GPT OSS 20B use?openai.com β†—2026-05-29to verify
How does GPT OSS 20B compare to GPT OSS 120B?openai.com β†—2026-05-29to verify
What hardware do I need to self-host GPT OSS 20B?github.com β†—2026-05-29to verify
Help & contact