GPT-OSS 20B
GPT-OSS 20B is a large language model with 20 billion parameters, designed for text generation, conversation, and various natural language processing tasks. This open-source model provides robust performance for a wide range of applications.
Model details
| Category | Details |
|---|---|
| Model Name | GPT-OSS 20B |
| Version | 20B |
| Model Category | Large Language Model (LLM) |
| Size | 20B parameters |
| HuggingFace Model | gpt-oss-20b |
| OpenAI Compatible Endpoint | Chat Completions |
| License | Apache 2.0 |
Capabilities
| Feature | Details |
|---|---|
| Tool Calling | ✅ |
| Context Length | 131k tokens |
| Supports LoRA | ❌ |
| Input data | Text |
Usage
Basic Chat Completion
This is a basic chat completion example using this model:
curl http://localhost:8000/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "stream": true, "model": "gpt-oss-20b", "max_tokens": 1024, "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Name the european capitals"} ]}'Response:
{"id":"chatcmpl-example","object":"chat.completion","created":1746821581,"model":"gpt-oss-20b","choices":[{"index":0,"message":{"role":"assistant","reasoning_content":null,"content":"Sure! Here is a list of some European capitals...","tool_calls":[]},"logprobs":null,"finish_reason":"stop","stop_reason":null}],"usage":{"prompt_tokens":9,"total_tokens":527,"completion_tokens":518,"prompt_tokens_details":null},"prompt_logprobs":null}| Property | Type | Description |
|---|---|---|
stream | boolean | Indicates whether to stream the response. |
messages[] | array | Array of message objects. |
messages[].role | string | The role of the message sender. |
messages[].content | string | The content of the message. |
Tool Calling Example
curl http://localhost:8000/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "stream": true, "model": "gpt-oss-20b", "max_tokens": 1024, "messages": [ {"role": "system", "content": "You are a helpful assistant with access to tools."}, {"role": "user", "content": "What is the weather in London?"} ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Get the current weather for a location", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state" } }, "required": ["location"] } } } ]}'Response:
{"id":"chatcmpl-tool-example","object":"chat.completion","created":1746821866,"model":"gpt-oss-20b","choices":[{"index":0,"message":{"role":"assistant","reasoning_content":null,"content":null,"tool_calls":[{"id":"chatcmpl-tool-fd3311e75aed4cbfbeb7244ced77379f","type":"function","function":{"name":"get_weather","arguments":"{\"location\": \"London\"}"}}]},"logprobs":null,"finish_reason":"tool_calls","stop_reason":null}],"usage":{"prompt_tokens":293,"total_tokens":313,"completion_tokens":20,"prompt_tokens_details":null},"prompt_logprobs":null}Advanced Usage with Parameters
This example shows how to use the model with additional parameters:
const modelResponse = await Azion.AI.run("gpt-oss-20b", { "stream": true, "max_tokens": 1024, "temperature": 0.7, "top_p": 0.9, "messages": [ { "role": "system", "content": "You are a helpful assistant that provides detailed explanations." }, { "role": "user", "content": "Explain the concept of machine learning in simple terms." } ]})| Property | Type | Description |
|---|---|---|
stream | boolean | Indicates whether to stream the response. |
max_tokens | integer | Maximum number of tokens to generate. |
temperature | number | Controls randomness in the output (0.0 to 2.0). |
top_p | number | Controls diversity via nucleus sampling (0.0 to 1.0). |
messages[] | array | Array of message objects. |
messages[].role | string | The role of the message sender. |
messages[].content | string | The content of the message. |
JSON Schema
{ "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", "required": [ "messages" ], "properties": { "messages": { "type": "array", "items": { "$ref": "#/components/schemas/Message" } }, "temperature": { "type": "number", "minimum": 0, "maximum": 2 }, "top_p": { "type": "number", "minimum": 0, "maximum": 1, "default": 1 }, "n": { "type": "integer", "minimum": 1, "default": 1 }, "stream": { "type": "boolean", "default": false }, "max_tokens": { "type": "integer", "minimum": 1 }, "presence_penalty": { "type": "number", "minimum": -2, "maximum": 2, "default": 0 }, "frequency_penalty": { "type": "number", "minimum": -2, "maximum": 2, "default": 0 } }, "components": { "schemas": { "Message": { "oneOf": [ { "$ref": "#/components/schemas/SystemMessage" }, { "$ref": "#/components/schemas/UserMessage" }, { "$ref": "#/components/schemas/AssistantMessage" } ] }, "SystemMessage": { "type": "object", "required": [ "role", "content" ], "properties": { "role": { "type": "string", "enum": [ "system" ] }, "content": { "$ref": "#/components/schemas/TextContent" } } }, "UserMessage": { "type": "object", "required": [ "role", "content" ], "properties": { "role": { "type": "string", "enum": [ "user" ] }, "content": { "$ref": "#/components/schemas/TextContent" } } }, "AssistantMessage": { "type": "object", "required": [ "role", "content" ], "properties": { "role": { "type": "string", "enum": [ "assistant" ] }, "content": { "$ref": "#/components/schemas/TextContent" } } }, "TextContent": { "type": "string", "description": "Text content provided as a string" } } }}