{"model_name":"openai/gpt-oss-20b","type":"text-generation","tags":["openai","tools","reasoning","json","structured-output","priority","flex"],"reported_type":"text-generation","version":"0kyxj4vf","description":"gpt-oss-20b is an open-weight 21B parameter model released by OpenAI under the Apache 2.0 license. It uses a Mixture-of-Experts (MoE) architecture with 3.6B active parameters per forward pass, optimized for lower-latency inference. The model is trained in OpenAI’s Harmony response format and supports reasoning level configuration, fine-tuning, and agentic capabilities including function calling, tool use, and structured outputs.","mf_description":"gpt-oss-20b is an open-weight 21B parameter model released by OpenAI under the Apache 2.0 license. It uses a Mixture-of-Experts (MoE) architecture with 3.6B active parameters per forward pass, optimized for lower-latency inference. The model is trained in OpenAI’s Harmony response format and supports reasoning level configuration, fine-tuning, and agentic capabilities including function calling, tool use, and structured outputs.","featured":false,"owner":false,"public":true,"curl_inv":"curl -X POST \\\n    -d '{\"input\": \"I have this dream\"}'  \\\n    -H \"Authorization: bearer $DEEPINFRA_TOKEN\"  \\\n    -H 'Content-Type: application/json'  \\\n    'https://api.deepinfra.com/v1/inference/openai/gpt-oss-20b'","cmdline_inv":"deepctl infer \\\n    -m 'openai/gpt-oss-20b'  \\\n    -i 'input=I have this dream'","txt_docs":"parameters:\n  input     : string. text to generate from\n  max_new_tokens: integer. maximum length of the newly generated text. If explicitly set to None it will be the model's max context length minus input length or 65536, whichever is smaller\n  temperature: (Default: 0.7) number. temperature to use for sampling. 0 means the output is deterministic. Values greater than 1 encourage more diversity\n  top_p     : (Default: 0.9) number. Sample from the set of tokens with highest probability such that sum of probabilies is higher than p. Lower values focus on the most probable tokens.Higher values sample more low-probability tokens\n  min_p     : (Default: 0.0) number. Float that represents the minimum probability for a token to be considered, relative to the probability of the most likely token. Must be in [0, 1]. Set to 0 to disable this.\n  top_k     : (Default: 0) integer. Sample from the best k (number of) tokens. 0 means off\n  repetition_penalty: (Default: 1.0) number. repetition penalty. Value of 1 means no penalty, values greater than 1 discourage repetition, smaller than 1 encourage repetition.\n  stop      : array. Up to 16 strings that will terminate generation immediately\n  num_responses: (Default: 1) integer. Number of output sequences to return. Incompatible with streaming\n  response_format: (Default: {'type': 'text'}) object. Optional nested object with \"type\" set to \"json_object\"\n  presence_penalty: (Default: 0) number. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.\n  frequency_penalty: (Default: 0) number. Positive values penalize new tokens based on how many times they appear in the text so far, increasing the model's likelihood to talk about new topics.\n  user      : string. A unique identifier representing your end-user, which can help monitor and detect abuse. Avoid sending us any identifying information. We recommend hashing user identifiers.\n  seed      : integer. Seed for random number generator. If not provided, a random seed is used. Determinism is not guaranteed.\n  prompt_cache_key: string. A key to identify prompt cache for reuse across requests. If provided, the prompt will be cached and can be reused in subsequent requests with the same key.\n  stream    : (Default: False) boolean. Whether to stream tokens, by default it will be false, currently only supported for Llama 2 text generation models, token by token updates will be sent over SSE\n  webhook   : string. The webhook to call when inference is done, by default you will get the output in the response of your inference request\n\nsend the parameters as EITHER:\n- JSON object (one key: value per parameter, binary as base64 or Data URL)\n- HTTP multipart (one part per parameter).\n","out_example":"{\n  \"results\": [\n    {\n      \"generated_text\": null\n    }\n  ],\n  \"num_tokens\": 42,\n  \"num_input_tokens\": 100,\n  \"request_id\": null,\n  \"inference_status\": {\n    \"status\": \"unknown\",\n    \"runtime_ms\": 0,\n    \"cost\": 0.0,\n    \"tokens_generated\": 0,\n    \"tokens_input\": 0,\n    \"output_length\": 0\n  }\n}\n","out_docs":"results: array[GeneratedText]. a list of generated texts\nGeneratedText fields:\n    generated_text: string. generated text, including the prompt\nnum_tokens: integer. number of generated tokens, excluding prompt\nnum_input_tokens: integer. number of input tokens\nrequest_id: string. The request id\ninference_status: object. Object containing the status of the inference request\n","in_schema":{"definitions":{"JsonObjectResponseFormat":{"properties":{"type":{"const":"json_object","default":"json_object","title":"Type","type":"string"}},"title":"JsonObjectResponseFormat","type":"object"},"JsonSchema":{"properties":{"name":{"description":"Name identifier for the JSON schema","title":"Name","type":"string"},"schema":{"additionalProperties":true,"description":"The actual JSON schema definition","title":"Schema","type":"object"}},"required":["name","schema"],"title":"JsonSchema","type":"object"},"JsonSchemaResponseFormat":{"properties":{"type":{"const":"json_schema","default":"json_schema","title":"Type","type":"string"},"json_schema":{"$ref":"#/definitions/JsonSchema","description":"JSON schema for structured output when type is 'json_schema'"}},"required":["json_schema"],"title":"JsonSchemaResponseFormat","type":"object"},"RegexResponseFormat":{"properties":{"type":{"const":"regex","default":"regex","title":"Type","type":"string"},"regex":{"description":"Regex pattern for structured output when type is 'regex'","title":"Regex","type":"string"}},"required":["regex"],"title":"RegexResponseFormat","type":"object"},"TextResponseFormat":{"properties":{"type":{"const":"text","default":"text","title":"Type","type":"string"}},"title":"TextResponseFormat","type":"object"}},"required":["input"],"title":"TextGenerationIn","type":"object","properties":{"input":{"description":"text to generate from","title":"Input","type":"string","example":"I have this dream"},"max_new_tokens":{"description":"maximum length of the newly generated text. If explicitly set to None it will be the model's max context length minus input length or 65536, whichever is smaller","maximum":1000000,"minimum":1,"title":"Max New Tokens","type":"integer","example":512},"temperature":{"default":0.7,"description":"temperature to use for sampling. 0 means the output is deterministic. Values greater than 1 encourage more diversity","maximum":100,"minimum":0,"title":"Temperature","type":"number","example":0.7},"top_p":{"default":0.9,"description":"Sample from the set of tokens with highest probability such that sum of probabilies is higher than p. Lower values focus on the most probable tokens.Higher values sample more low-probability tokens","exclusiveMinimum":0,"maximum":1,"title":"Top P","type":"number","example":0.9},"min_p":{"default":0,"description":"Float that represents the minimum probability for a token to be considered, relative to the probability of the most likely token. Must be in [0, 1]. Set to 0 to disable this.","maximum":1,"minimum":0,"title":"Min P","type":"number","example":0.1},"top_k":{"default":0,"description":"Sample from the best k (number of) tokens. 0 means off","exclusiveMaximum":1000,"minimum":0,"title":"Top K","type":"integer","example":50},"repetition_penalty":{"default":1,"description":"repetition penalty. Value of 1 means no penalty, values greater than 1 discourage repetition, smaller than 1 encourage repetition.","maximum":5,"minimum":0.01,"title":"Repetition Penalty","type":"number","example":1},"stop":{"description":"Up to 16 strings that will terminate generation immediately","items":{"type":"string"},"title":"Stop","type":"array"},"num_responses":{"default":1,"description":"Number of output sequences to return. Incompatible with streaming","maximum":4,"minimum":1,"title":"Num Responses","type":"integer"},"response_format":{"anyOf":[{"$ref":"#/definitions/TextResponseFormat"},{"$ref":"#/definitions/JsonObjectResponseFormat"},{"$ref":"#/definitions/JsonSchemaResponseFormat"},{"$ref":"#/definitions/RegexResponseFormat"}],"default":{"type":"text"},"description":"Optional nested object with \"type\" set to \"json_object\"","title":"Response Format"},"presence_penalty":{"default":0,"description":"Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.","maximum":2,"minimum":-2,"title":"Presence Penalty","type":"number"},"frequency_penalty":{"default":0,"description":"Positive values penalize new tokens based on how many times they appear in the text so far, increasing the model's likelihood to talk about new topics.","maximum":2,"minimum":-2,"title":"Frequency Penalty","type":"number"},"user":{"description":"A unique identifier representing your end-user, which can help monitor and detect abuse. Avoid sending us any identifying information. We recommend hashing user identifiers.","title":"User","type":"string"},"seed":{"description":"Seed for random number generator. If not provided, a random seed is used. Determinism is not guaranteed.","exclusiveMaximum":18446744073709551616,"minimum":-9223372036854775808,"title":"Seed","type":"integer"},"prompt_cache_key":{"description":"A key to identify prompt cache for reuse across requests. If provided, the prompt will be cached and can be reused in subsequent requests with the same key.","title":"Prompt Cache Key","type":"string"},"webhook":{"description":"The webhook to call when inference is done, by default you will get the output in the response of your inference request","format":"uri","is_base_field":true,"maxLength":2083,"minLength":1,"title":"Webhook","type":"string"},"stream":{"default":false,"description":"Whether to stream tokens, by default it will be false, currently only supported for Llama 2 text generation models, token by token updates will be sent over SSE","is_base_field":true,"title":"Stream","type":"boolean","example":true}}},"out_schema":{"definitions":{"GeneratedText":{"properties":{"generated_text":{"description":"generated text, including the prompt","examples":["I have this dream about the day I got a job at a tech company. I just woke up on a plane. I sat down on the floor and started getting work done. After getting up around 6 p.m., I looked around and"],"title":"Generated Text","type":"string"}},"required":["generated_text"],"title":"GeneratedText","type":"object"},"InferenceReplyStatus":{"properties":{"status":{"choices":["unknown","queued","running","succeeded","failed"],"default":"succeeded","description":"Inference status","title":"Status","type":"string"},"runtime_ms":{"default":0,"description":"runtime in milliseconds","title":"Runtime Ms","type":"integer"},"cost":{"description":"estimated cost billed for the request in USD","title":"Cost","type":"number"},"tokens_generated":{"description":"number of tokens generated","title":"Tokens Generated","type":"integer"},"tokens_input":{"description":"number of input tokens","title":"Tokens Input","type":"integer"},"output_length":{"description":"length of the output in seconds","title":"Output Length","type":"integer"}},"required":["cost"],"title":"InferenceReplyStatus","type":"object"}},"required":["results"],"title":"TextGenerationOut","type":"object","properties":{"results":{"description":"a list of generated texts","items":{"$ref":"#/definitions/GeneratedText"},"title":"Results","type":"array"},"num_tokens":{"description":"number of generated tokens, excluding prompt","title":"Num Tokens","type":"integer","example":42},"num_input_tokens":{"description":"number of input tokens","title":"Num Input Tokens","type":"integer","example":100},"request_id":{"description":"The request id","is_base_field":true,"title":"Request Id","type":"string"},"inference_status":{"$ref":"#/definitions/InferenceReplyStatus","description":"Object containing the status of the inference request","is_base_field":true,"type":"object","title":"InferenceReplyStatus"}}},"in_fields":[{"name":"input","parent":null,"ftype":"string","description":"text to generate from","allowed":null,"default":null,"examples":["I have this dream"],"minimum":null,"exclusiveMinimum":null,"maximum":null,"exclusiveMaximum":null},{"name":"max_new_tokens","parent":null,"ftype":"integer","description":"maximum length of the newly generated text. If explicitly set to None it will be the model's max context length minus input length or 65536, whichever is smaller","allowed":null,"default":null,"examples":[512],"minimum":1.0,"exclusiveMinimum":null,"maximum":1000000.0,"exclusiveMaximum":null},{"name":"temperature","parent":null,"ftype":"number","description":"temperature to use for sampling. 0 means the output is deterministic. Values greater than 1 encourage more diversity","allowed":null,"default":0.7,"examples":[0.7],"minimum":0.0,"exclusiveMinimum":null,"maximum":100.0,"exclusiveMaximum":null},{"name":"top_p","parent":null,"ftype":"number","description":"Sample from the set of tokens with highest probability such that sum of probabilies is higher than p. Lower values focus on the most probable tokens.Higher values sample more low-probability tokens","allowed":null,"default":0.9,"examples":[0.9],"minimum":null,"exclusiveMinimum":0.0,"maximum":1.0,"exclusiveMaximum":null},{"name":"min_p","parent":null,"ftype":"number","description":"Float that represents the minimum probability for a token to be considered, relative to the probability of the most likely token. Must be in [0, 1]. Set to 0 to disable this.","allowed":null,"default":0,"examples":[0.1],"minimum":0.0,"exclusiveMinimum":null,"maximum":1.0,"exclusiveMaximum":null},{"name":"top_k","parent":null,"ftype":"integer","description":"Sample from the best k (number of) tokens. 0 means off","allowed":null,"default":0,"examples":[50],"minimum":0.0,"exclusiveMinimum":null,"maximum":null,"exclusiveMaximum":1000.0},{"name":"repetition_penalty","parent":null,"ftype":"number","description":"repetition penalty. Value of 1 means no penalty, values greater than 1 discourage repetition, smaller than 1 encourage repetition.","allowed":null,"default":1,"examples":[1],"minimum":0.01,"exclusiveMinimum":null,"maximum":5.0,"exclusiveMaximum":null},{"name":"stop","parent":null,"ftype":"array","description":"Up to 16 strings that will terminate generation immediately","allowed":null,"default":null,"examples":[],"minimum":null,"exclusiveMinimum":null,"maximum":null,"exclusiveMaximum":null},{"name":"num_responses","parent":null,"ftype":"integer","description":"Number of output sequences to return. Incompatible with streaming","allowed":null,"default":1,"examples":[],"minimum":1.0,"exclusiveMinimum":null,"maximum":4.0,"exclusiveMaximum":null},{"name":"response_format","parent":null,"ftype":"any","description":"Optional nested object with \"type\" set to \"json_object\"","allowed":null,"default":{"type":"text"},"examples":[],"minimum":null,"exclusiveMinimum":null,"maximum":null,"exclusiveMaximum":null},{"name":"presence_penalty","parent":null,"ftype":"number","description":"Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.","allowed":null,"default":0,"examples":[],"minimum":-2.0,"exclusiveMinimum":null,"maximum":2.0,"exclusiveMaximum":null},{"name":"frequency_penalty","parent":null,"ftype":"number","description":"Positive values penalize new tokens based on how many times they appear in the text so far, increasing the model's likelihood to talk about new topics.","allowed":null,"default":0,"examples":[],"minimum":-2.0,"exclusiveMinimum":null,"maximum":2.0,"exclusiveMaximum":null},{"name":"user","parent":null,"ftype":"string","description":"A unique identifier representing your end-user, which can help monitor and detect abuse. Avoid sending us any identifying information. We recommend hashing user identifiers.","allowed":null,"default":null,"examples":[],"minimum":null,"exclusiveMinimum":null,"maximum":null,"exclusiveMaximum":null},{"name":"seed","parent":null,"ftype":"integer","description":"Seed for random number generator. If not provided, a random seed is used. Determinism is not guaranteed.","allowed":null,"default":null,"examples":[],"minimum":-9.223372036854776e+18,"exclusiveMinimum":null,"maximum":null,"exclusiveMaximum":1.8446744073709552e+19},{"name":"prompt_cache_key","parent":null,"ftype":"string","description":"A key to identify prompt cache for reuse across requests. If provided, the prompt will be cached and can be reused in subsequent requests with the same key.","allowed":null,"default":null,"examples":[],"minimum":null,"exclusiveMinimum":null,"maximum":null,"exclusiveMaximum":null},{"name":"webhook","parent":null,"ftype":"file","description":"The webhook to call when inference is done, by default you will get the output in the response of your inference request","allowed":null,"default":null,"examples":[],"minimum":null,"exclusiveMinimum":null,"maximum":null,"exclusiveMaximum":null},{"name":"stream","parent":null,"ftype":"boolean","description":"Whether to stream tokens, by default it will be false, currently only supported for Llama 2 text generation models, token by token updates will be sent over SSE","allowed":null,"default":false,"examples":[true],"minimum":null,"exclusiveMinimum":null,"maximum":null,"exclusiveMaximum":null}],"pricing":{"discount":null,"discount_ends_at":null,"short":null,"full":null,"table":null,"type":"tokens","cents_per_input_token":3e-06,"cents_per_output_token":1.4e-05,"rate_per_input_token_cached":null,"rate_per_input_token_cache_write":null,"rate_per_service_tier_priority":1.5,"rate_per_service_tier_flex":0.8,"rate_per_explicit_cache_write_token":null,"explicit_cache_granularity_tokens":null},"doc_blocks":[{"key":"openai-http","url":"/models/openai/gpt-oss-20b/docs/openai-http.md"},{"key":"openai-python","url":"/models/openai/gpt-oss-20b/docs/openai-python.md"},{"key":"openai-js","url":"/models/openai/gpt-oss-20b/docs/openai-js.md"},{"key":"ai-sdk-js","url":"/models/openai/gpt-oss-20b/docs/ai-sdk-js.md"},{"key":"http","url":"/models/openai/gpt-oss-20b/docs/http.md"},{"key":"deepctl","url":"/models/openai/gpt-oss-20b/docs/deepctl.md"},{"key":"js-text-gen","url":"/models/openai/gpt-oss-20b/docs/js-text-gen.md"}],"short_doc_block":{"key":"openai-python-short","url":"/models/openai/gpt-oss-20b/docs/openai-python-short.md"},"schemas":[{"key":"openai-chat-completions","url":"/models/openai/gpt-oss-20b/schema/openai-chat-completions"},{"key":"openai-completions","url":"/models/openai/gpt-oss-20b/schema/openai-completions"},{"key":"ai-sdk","url":"/models/openai/gpt-oss-20b/schema/ai-sdk"},{"key":"default","url":"/models/openai/gpt-oss-20b/schema/default"}],"meta":{"github_url":"https://huggingface.co/openai/gpt-oss-20b","license_url":"https://huggingface.co/datasets/choosealicense/licenses/blob/main/markdown/apache-2.0.md","readme":"https://shared.deepinfra.com/models/openai/gpt-oss-20b/readme.0f9ba18a1ecd734c689179745ed4b40ce920eb3822bb1a26dfbd4011d697631c.md","cover_img_url":"https://shared.deepinfra.com/models/openai/gpt-oss-20b/cover_image.4841ba1e78220022449bec081f219edc092a81653a7a32e8984ddec2d7ad0f3d.webp"},"max_tokens":131072,"max_output_tokens":131072,"replaced_by":null,"deprecated":null,"quantization":"bfloat16","mmlu":null,"expected":null,"import_time":"2025-08-06T00:56:44.020504+00:00","is_partner":false,"is_custom_deployable":true,"mf_name":null,"mf_title":null}