GPT-OSS 120B API
Available PopularGPT-OSS 120B is OpenAI's open-weight mixture-of-experts model (117B parameters, 5.1B active). It reasons before answering, supports tool calling and structured output, and is the model Groq points users to as the replacement for Llama 3.3 70B. Serve it here with pay-per-request billing and no daily cap.
Quickstart
Set INFERENCE_API_KEY to your key from the API Keys page, then run:
curl https://api.inferenceapis.com/v1/chat/completions \
-H "Authorization: Bearer $INFERENCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "openai/gpt-oss-120b",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello! What can you do?"}
]
}'
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.inferenceapis.com/v1",
api_key=os.environ["INFERENCE_API_KEY"],
)
response = client.chat.completions.create(
model="openai/gpt-oss-120b",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello! What can you do?"},
],
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.inferenceapis.com/v1",
apiKey: process.env.INFERENCE_API_KEY,
});
const response = await client.chat.completions.create({
model: "openai/gpt-oss-120b",
messages: [
{ role: "system", content: "You are a helpful assistant." },
{ role: "user", content: "Hello! What can you do?" },
],
});
console.log(response.choices[0].message.content);
When to use it
- You are replacing llama-3.3-70b-versatile and want the model Groq itself recommends
- You build agents: tool calling, JSON-schema output and a visible reasoning trace are all verified on this endpoint
- You need more than 131K tokens of context
What it costs in practice
| Workload | Cost |
|---|---|
| Chat assistant — 10,000 turns of 800 tokens in, 300 out | $4.00 |
| Long prompts or RAG — 10,000 requests of 8,000 in, 500 out | $20.00 |
| Generation-heavy — 10,000 requests of 500 in, 2,000 out | $17.00 |
Computed from the live rates below. This is a reasoning model, and thinking is billed as output, so real output counts run above the visible answer; see controlling reasoning to keep that down. There is no subscription or minimum; new accounts start with free credit.
Endpoint
Content-Type: application/json
/openai/v1/… is accepted too, so Groq-style base URLs work with only the host changed.
Model IDs and aliases
Send any of these as model; they all resolve to this model and bill at its rate.
| ID | Note |
|---|---|
openai/gpt-oss-120b | Canonical |
gpt-oss-120b | Alias |
Request body
| Parameter | Type | Description |
|---|---|---|
model required |
string | Model ID: openai/gpt-oss-120b — also accepted: gpt-oss-120b |
messages required |
array | Conversation so far. Each item has a role (system, user or assistant) and content. |
max_tokens |
integer | Maximum number of tokens to generate (includes reasoning tokens — use a few hundred or more). |
temperature |
number | Sampling temperature. Higher values give more varied output. |
top_p |
number | Nucleus sampling cutoff. |
stream |
boolean | Stream the response as server-sent events. The final chunk includes usage. |
tools |
array | Tool definitions for function calling (OpenAI format). |
response_format |
object | {"type": "json_object"} for JSON mode. |
stop |
string | array | Sequences where the model stops generating. |
seed |
integer | Seed for more reproducible sampling. |
Response
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "openai/gpt-oss-120b",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hi! I can answer questions, write and edit text, help with code and more.",
"reasoning": "The user is greeting me and asking about capabilities..."
},
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 28, "completion_tokens": 17, "total_tokens": 45 }
}
Controlling reasoning
Set reasoning_effort to low, medium or high. On the same question we measured 20, 81 and 388 reasoning tokens respectively, and reasoning tokens are billed as output. Use low for chat, extraction and classification; keep high for multi-step problems. GPT-OSS has no off switch: "none", which turns thinking off on the other models here, is sent as low. All models compared.
resp = client.chat.completions.create(
model="openai/gpt-oss-120b",
reasoning_effort="low", # low | medium | high
messages=[{"role": "user", "content": "Classify this ticket: 'card declined twice'"}],
max_tokens=500,
)
print(resp.choices[0].message.content)
print(resp.usage.completion_tokens_details.reasoning_tokens)Token counts are single measurements from September 17, 2026 and vary with the question; the direction is what matters.
Tested on this endpoint
Tool calling (tools, tool_calls) | Works |
JSON mode (response_format: json_object) | Works |
Schema-constrained output (response_format: json_schema) | Works |
Streaming with usage in the final chunk | Works |
| System prompt followed | Works |
Reasoning tokens reported in usage | Works |
Each row is a live request we sent on September 17, 2026, not a claim copied from a model card. Streamed and parallel tool calls and tool_choice were tested too: full matrix for every model. Request examples are in the API documentation.
Pricing
| Input | $0.20 / 1M tokens |
| Output | $0.80 / 1M tokens |
| Billing | Pay as you go from prepaid credits. No subscription, no daily request or token cap. See all pricing. |
Notes
- This is a reasoning model: it spends tokens thinking before it answers. Set
max_tokensto at least a few hundred or the reply can come back empty with only thereasoningfield populated. - The response includes a
reasoningfield alongsidecontent;usage.completion_tokens_details.reasoning_tokensreports how many tokens were spent thinking.
Compare GPT-OSS 120B with…
Questions about GPT-OSS 120B
Is this the same GPT-OSS 120B that Groq serves?
Yes. It is the same open-weight model published by OpenAI, under the same id, openai/gpt-oss-120b. Answers differ only by sampling. What differs between hosts is price, speed and the limits on your account; see GPT-OSS 120B here vs on Groq.
How do I keep the cost down on a reasoning model?
Reasoning tokens are billed as output tokens and usually outnumber the visible answer. Set reasoning_effort to low unless the task needs more, and read usage.completion_tokens_details.reasoning_tokens to see what you paid for thinking.
Why did content come back empty?
max_tokens covers reasoning and answer together. With a small budget the model spends all of it thinking: content is empty, reasoning is populated and finish_reason is length. Allow a few hundred tokens or more.
Does it accept images?
No. GPT-OSS 120B is text in, text out. For images use Qwen3-VL 235B on the same endpoint and key.
Can I use the output commercially?
The model is released under Apache 2.0, which permits commercial use. Our terms leave ownership of output with you.
Licence
GPT-OSS 120B is published by OpenAI under the Apache 2.0. Your use of its output is also subject to that licence.
Errors
Errors use the OpenAI envelope: {"error": {"message", "type", "code"}}. 401 missing or invalid key · 402 insufficient_balance · 404 model_not_found · 503 model_unavailable · 502 backend error, safe to retry. Full table with what to retry: API documentation. Errors from other providers: provider error reference.
