Skip to content

gpt-oss-120b

Open-weight reasoning model for agents and coding at a very low price, with a 131K context window.

  • by OpenAI
  • Text
  • $0.03 / $0.15 per M
On this page

1.Call

OpenAI-compatible chat completions; works with the official OpenAI SDKs. Every response carries an x-request-id trace ID.

curl https://api.ewest.ai/v1/chat/completions \
  -H "Authorization: Bearer $EWEST_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "ewest/gpt-oss-120b", "stream": true,
       "messages": [{"role": "user", "content": "Hello!"}]}'

2.Authentication

Send your API key in the Authorization: Bearer header, as the examples above do (clients built for the Anthropic API can use x-api-key). Create keys under API keys. Keep the key on your server, never in browser code. More in the authentication guide.

3.Schema

What you send and what comes back, for ewest/gpt-oss-120b. The output tables are read from the API's OpenAPI description.

Input

POST /v1/chat/completions
  • modelstringRequired
    The model id, ewest/gpt-oss-120b.
  • messagesarrayRequired
    The conversation so far: objects with role (system, user, assistant) and content.
  • streambooleanOptionaldefault false
    Send the answer as Server-Sent Events while it is written.
  • max_tokensintegerOptional
    Most tokens to generate. The context window is 131,072 tokens.
  • temperaturenumberOptional
    Randomness, 0 to 2. Lower is more focused.
  • toolsarrayOptional
    Functions the model may call (OpenAI tool format).

Output

Returns text. POST /v1/chat/completions answers 200: The completion (JSON), or with stream: true a stream of chat.completion.chunk events ending with data: [DONE].

  • idstringAlways
    Unique id of the completion.
  • objectstringAlways
    Always chat.completion. Always chat.completion.
  • createdintegerAlways
    Unix seconds when the completion was created.
  • modelstringAlways
    The model that answered (a fallback, if one did).
  • choicesarray of objectAlways
    The answers, one per requested choice.
  • choices[].indexintegerAlways
    Position of this choice.
  • choices[].finish_reasonstring or nullSometimes
    Why the model stopped: stop, length, tool_calls, content_filter.
  • choices[].messageobjectAlways
    The assistant's answer.
  • choices[].message.rolestringAlways
    Always assistant.
  • choices[].message.contentstring or nullSometimes
    The text of the answer; null when the model answered with tool calls only.
  • choices[].message.refusalstring or nullSometimes
    The model's refusal text, when it declined to answer.
  • choices[].message.tool_callsarray of object or nullSometimes
    Tools the model asks you to run.
  • choices[].message.tool_calls[].idstringSometimes
    Id of the call; send it back as tool_call_id in the tool's result message.
  • choices[].message.tool_calls[].indexintegerSometimes
    Position of the call in the list.
  • choices[].message.tool_calls[].typestringSometimes
    Always function. The kind of tool; only functions exist.
  • choices[].message.tool_calls[].functionobjectAlways (when set)
    The function to run.
  • choices[].message.tool_calls[].function.namestringSometimes
    Name of the function.
  • choices[].message.tool_calls[].function.argumentsstringSometimes
    JSON-encoded arguments.
  • choices[].message.function_callobject or nullSometimes
    The call of a legacy functions request; newer requests use tool_calls.
  • choices[].message.function_call.namestringSometimes
    Name of the function.
  • choices[].message.function_call.argumentsstringSometimes
    JSON-encoded arguments.
  • choices[].message.audioobject or nullSometimes
    Spoken answer, for models that can reply with audio.
  • choices[].message.audio.idstringSometimes
    Id of the audio.
  • choices[].message.audio.datastringSometimes
    Base64-encoded audio bytes.
  • choices[].message.audio.expires_atintegerSometimes
    Unix seconds after which the audio can no longer be referenced.
  • choices[].message.audio.transcriptstringSometimes
    Text of the spoken answer.
  • choices[].message.reasoning_contentstring or nullSometimes
    The model's reasoning text, for models that return it.
  • choices[].message.thinking_blocksarray of object or nullSometimes
    Reasoning blocks, for models that return them.
  • choices[].message.annotationsarray of object or nullSometimes
    Annotations on the text, such as URL citations, where the model gives them.
  • choices[].message.imagesarray of object or nullSometimes
    Images the model generated, for models with image output.
  • choices[].logprobsobject or nullSometimes
    Token log probabilities, when requested.
  • usageobjectSometimes
    Token usage of the request.
  • usage.prompt_tokensintegerSometimes
    Tokens in the input.
  • usage.completion_tokensintegerSometimes
    Tokens in the output, reasoning tokens included.
  • usage.total_tokensintegerSometimes
    prompt_tokens plus completion_tokens.
  • usage.prompt_tokens_detailsobject or nullSometimes
    Breakdown of the input tokens (for example cached or audio tokens), where the model reports one.
  • usage.completion_tokens_detailsobject or nullSometimes
    Breakdown of the output tokens (for example reasoning tokens), where the model reports one.
  • usage.cache_creation_input_tokensinteger or nullSometimes
    Input tokens written to the prompt cache, for models with prompt caching.
  • usage.cache_read_input_tokensinteger or nullSometimes
    Input tokens read from the prompt cache, for models with prompt caching.
  • system_fingerprintstring or nullSometimes
    Identifies the model configuration that answered, when the model reports one.
  • service_tierstring or nullSometimes
    The service tier that handled the request, when the model reports one.

Sample response

{
  "id": "chatcmpl-0000",
  "object": "chat.completion",
  "created": 1793530277,
  "model": "ewest/gpt-oss-120b",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      }
    }
  ],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 9,
    "total_tokens": 18
  }
}

4.Details

Context window
131,072 tokens
API
OpenAI-compatible chat completions, streaming