LLM Reference
OpenAI API

gpt-oss-20b on OpenAI API

GPT-OSS · OpenAI

ServerlessOpen Source

Last refreshed 2026-04-19. Next refresh: weekly.

Why use gpt-oss-20b on OpenAI API?

OpenAI API offers gpt-oss-20b with competitive pricing. OpenAI is a leading AI research and deployment company dedicated to developing safe and beneficial artificial general intelligence (AGI) for humanity.

Compare gpt-oss-20b across 11 providers to find the best fit for your use case
Input / 1M
-
Output / 1M
-
Cache
Not sourced
Batch
Not sourced

Setup recipe

Python + curl
Install
pip install openai
Auth
export OPENAI_API_KEY=...
Call
import os
from openai import OpenAI
client = OpenAI()  # reads OPENAI_API_KEY from env
response = client.chat.completions.create(
Model ID
gpt-oss-20b

Request example

import os
from openai import OpenAI

client = OpenAI()  # reads OPENAI_API_KEY from env
response = client.chat.completions.create(
    model="gpt-oss-20b",
    messages=[{"role": "user", "content": "Hello"}]
)
print(response.choices[0].message.content)

Gotchas

  • Use the model slug directly, e.g. "gpt-4o" or "gpt-4.1-mini".
  • The examples expect OPENAI_API_KEY; rename it only if your application config maps the new variable.

Compare gpt-oss-20b Across Providers

ProviderInput (per 1M)Output (per 1M)
Cloudflare Workers AI$0.20$0.30
OpenRouter$0.03$0.14
Fireworks AI$0.07$0.30
GCP Vertex AI$0.07$0.25
NVIDIA NIM
View all 11 providers →

Capabilities

JSON / Tool useStructured Outputs

About gpt-oss-20b

OpenAI open-weight model with 20 billion parameters. Lightweight, efficient text-only model with reasoning and function calling. Free for self-hosting. Released August 5, 2025.

Get Started