---
title: Gpt Oss 20b API | Text Generation | ModelsLab
description: Medium-sized 21B-parameter Mixture-of-Experts LLM optimized for low-latency local deployment on 16GB memory devices, offering configurable reasoning and.
url: https://modelslab.com/models/openai/gpt-oss-20b/api.md
canonical: https://modelslab.com/models/openai/gpt-oss-20b/api.md
type: product
component: Playground/LLM/Index
generated_at: 2026-04-24T23:31:17.541754Z
---

gpt-oss-20b
---

 [LLMs.txt](https://modelslab.com/models/openai/gpt-oss-20b/llms.txt) [.md](https://modelslab.com/models/openai/gpt-oss-20b.md)

gpt-oss-20b openai Closed Source Model $0.085000 / call

gpt-oss-20b
---

Choose a prompt below to get started or type your own message

 Explain quantum computing in simple terms

 Write a Python function to sort a list

 Create a marketing email for a SaaS product

 Compare REST vs GraphQL APIs

Send

### gpt-oss-20b

openai gpt-oss-20b

Copy model ID

PricingInput $0.03 / 1M tokens

Output $0.14 / 1M tokens

API EndpointsOpenAI Compatible

`https://modelslab.com/api/v7/llm/chat/completions`Endpoint

Anthropic Compatible

`https://modelslab.com/api/v7/llm/v1/messages`Messages

`https://modelslab.com/api/v7/llm/v1/messages/count_tokens`Count Tokens

`https://modelslab.com/api/v7/llm/v1/models`Models

Use with Claude Code

cURL Example

ParametersSystem MessageYou are a helpful AI assistant specialized in providing accurate and detailed responses.

Temperature0.7

Max Tokens1000

Top P0.9

Frequency Penalty0

Presence Penalty0

Model Info

Support

Related Models
---

Discover similar models you might be interested in

 [View all LLM Models](https://modelslab.com/models?feature=llmaster)

[CV](https://modelslab.com/models/together_ai/deepcogito-cogito-v2-1-671b)[Together AI](https://modelslab.com/models/together_ai)

 [Cogito v2.1 671B

Closed Source Model](https://modelslab.com/models/together_ai/deepcogito-cogito-v2-1-671b)

[OO](https://modelslab.com/models/open_router/openai-o4-mini-deep-research)[Open Router](https://modelslab.com/models/open_router)

 [OpenAI: o4 Mini Deep Research

Closed Source Model](https://modelslab.com/models/open_router/openai-o4-mini-deep-research)

[Q1](https://modelslab.com/models/together_ai/Qwen-Qwen3-1.7B-Base)[Together AI](https://modelslab.com/models/together_ai)

 [Qwen3 1.7B Base

Closed Source Model](https://modelslab.com/models/together_ai/Qwen-Qwen3-1.7B-Base)

[GG](https://modelslab.com/models/open_router/google-gemini-3-flash-preview)[Open Router](https://modelslab.com/models/open_router)

 [Google: Gemini 3 Flash Preview

Closed Source Model](https://modelslab.com/models/open_router/google-gemini-3-flash-preview)

[Q4](https://modelslab.com/models/together_ai/Qwen-Qwen3-4B-Base)[Together AI](https://modelslab.com/models/together_ai)

 [Qwen3 4B Base

Closed Source Model](https://modelslab.com/models/together_ai/Qwen-Qwen3-4B-Base)

[OG](https://modelslab.com/models/open_router/openai-gpt-5-mini)[Open Router](https://modelslab.com/models/open_router)

 [OpenAI: GPT-5 Mini

Closed Source Model](https://modelslab.com/models/open_router/openai-gpt-5-mini)

[MS](https://modelslab.com/models/open_router/mistralai-mistral-saba)[Open Router](https://modelslab.com/models/open_router)

 [Mistral: Saba

Closed Source Model](https://modelslab.com/models/open_router/mistralai-mistral-saba)

[GG](https://modelslab.com/models/open_router/google-gemma-3-12b-it-free)[Open Router](https://modelslab.com/models/open_router)

 [Google: Gemma 3 12B (free)

Closed Source Model](https://modelslab.com/models/open_router/google-gemma-3-12b-it-free)

[OG](https://modelslab.com/models/open_router/openai-gpt-oss-safeguard-20b)[Open Router](https://modelslab.com/models/open_router)

 [OpenAI: gpt-oss-safeguard-20b

Closed Source Model](https://modelslab.com/models/open_router/openai-gpt-oss-safeguard-20b)

[KK](https://modelslab.com/models/together_ai/moonshotai-Kimi-K2-Thinking)[Together AI](https://modelslab.com/models/together_ai)

 [Kimi K2 Thinking

Closed Source Model](https://modelslab.com/models/together_ai/moonshotai-Kimi-K2-Thinking)

[OG](https://modelslab.com/models/open_router/openai-gpt-4.1-mini)[Open Router](https://modelslab.com/models/open_router)

 [OpenAI: GPT-4.1 Mini

Closed Source Model](https://modelslab.com/models/open_router/openai-gpt-4.1-mini)

[QQ](https://modelslab.com/models/open_router/qwen-qwen3.5-27b)[Open Router](https://modelslab.com/models/open_router)

 [Qwen: Qwen3.5-27B

Closed Source Model](https://modelslab.com/models/open_router/qwen-qwen3.5-27b)

[AC](https://modelslab.com/models/open_router/anthropic-claude-3.7-sonnet-thinking)[Open Router](https://modelslab.com/models/open_router)

 [Anthropic: Claude 3.7 Sonnet (thinking)

Closed Source Model](https://modelslab.com/models/open_router/anthropic-claude-3.7-sonnet-thinking)

[KK](https://modelslab.com/models/open_router/kwaipilot-kat-coder-pro-v2)[Open Router](https://modelslab.com/models/open_router)

 [Kwaipilot: KAT-Coder-Pro V2

Closed Source Model](https://modelslab.com/models/open_router/kwaipilot-kat-coder-pro-v2)

[AC](https://modelslab.com/models/open_router/anthropic-claude-3-haiku)[Open Router](https://modelslab.com/models/open_router)

 [Anthropic: Claude 3 Haiku

Closed Source Model](https://modelslab.com/models/open_router/anthropic-claude-3-haiku)

[QQ](https://modelslab.com/models/open_router/qwen-qwen3-32b)[Open Router](https://modelslab.com/models/open_router)

 [Qwen: Qwen3 32B

Closed Source Model](https://modelslab.com/models/open_router/qwen-qwen3-32b)

[L2](https://modelslab.com/models/together_ai/LiquidAI-LFM2-24B-A2B)[Together AI](https://modelslab.com/models/together_ai)

 [LFM2-24B-A2B

Closed Source Model](https://modelslab.com/models/together_ai/LiquidAI-LFM2-24B-A2B)

[MK](https://modelslab.com/models/open_router/moonshotai-kimi-k2-thinking)[Open Router](https://modelslab.com/models/open_router)

 [MoonshotAI: Kimi K2 Thinking

Closed Source Model](https://modelslab.com/models/open_router/moonshotai-kimi-k2-thinking)

About Gpt-Oss-20b
---

GPT-OSS 20B is a smaller open-weight model, designed for efficient reasoning and coding, lightweight enough to run on consumer GPUs.

### Technical Specifications

Model IDgpt-oss-20bCategoryLLM ModelsTaskText GenerationPrice$0.085000 per million tokensAddedAugust 5, 2025

### Key Features

- Chat completion and multi-turn conversation API
- Streaming response with token-by-token output
- Function calling and tool use support
- System prompts and role-based messaging
- JSON mode and structured output

### Quick Start

Integrate Gpt-Oss-20b into your application with a single API call. Get your API key from the [pricing page](https://modelslab.com/pricing) to get started.

PythonJavaScriptcURLPHP

```
<code>import requests
import json

url = "https://modelslab.com/api/v7/llm/chat/completions"

headers = {
    "Content-Type": "application/json"
}

data = {
        "model_id": "gpt-oss-20b",
        "messages": [
            {
                "role": "user",
                "content": "Hello!"
            }
        ],
        "max_tokens": 1000,
        "key": "YOUR_API_KEY"
    }

try:
    response = requests.post(url, headers=headers, json=data)
    response.raise_for_status()  # Raises an HTTPError for bad responses (4XX or 5XX)
    result = response.json()
    print("API Response:")
    print(json.dumps(result, indent=2))
except requests.exceptions.HTTPError as http_err:
    print(f"HTTP error occurred: {http_err} - {response.text}")
except Exception as err:
    print(f"Other error occurred: {err}")</code>
```

View the [full API documentation](https://modelslab.com/models/openai/gpt-oss-20b/api) for SDKs, code examples in Python, JavaScript, and more.

### Pricing

Gpt-Oss-20b API costs $0.085000 per million tokens. Pay only for what you use with no minimum commitments. [View pricing plans](https://modelslab.com/pricing)

### Use Cases

- AI chatbots and virtual assistants
- Code generation and developer tools
- Content writing and copywriting automation
- Data analysis, summarization, and extraction

[Learn more about Gpt-Oss-20b](https://modelslab.com/gpt-oss-20b) [Browse LLM Models](https://modelslab.com/models?feature=llmaster) [More from Openai](https://modelslab.com/models/open_router) [View Pricing](https://modelslab.com/pricing)

Gpt-Oss-20b FAQ
---

### What is Gpt-Oss-20b?

GPT-OSS 20B is a smaller open-weight model, designed for efficient reasoning and coding, lightweight enough to run on consumer GPUs.

### How do I use the Gpt-Oss-20b API?

You can integrate Gpt-Oss-20b into your application with a single API call. Sign up on ModelsLab to get your API key, then use the model ID "gpt-oss-20b" in your API requests. We provide SDKs for Python, JavaScript, and cURL examples in the API documentation.

### How much does Gpt-Oss-20b cost?

Gpt-Oss-20b costs $0.085000 per million tokens. ModelsLab uses pay-per-use pricing with no minimum commitments. A free tier is available to get started.

### What is the Gpt-Oss-20b model ID?

The model ID for Gpt-Oss-20b is "gpt-oss-20b". Use this ID in your API requests to specify this model.

### Does Gpt-Oss-20b have a free tier?

Yes, ModelsLab offers a free tier that lets you try Gpt-Oss-20b and other AI models. Sign up to get free API credits and start building immediately.

---

*This markdown version is optimized for AI agents and LLMs.*

**Links:**
- [Website](https://modelslab.com)
- [API Documentation](https://docs.modelslab.com)
- [Blog](https://modelslab.com/blog)

---
*Generated by ModelsLab - 2026-04-25*