Documentation
API Reference
Playground
Chat completionsResponsesSystem One
Document classificationEmbeddings

Studio API

Upload fileList filesRetrieve fileDelete file
Create jobRetrieve job

Search

Create vector storeList vector storesRetrieve vector storeModify vector storeDelete vector storeAdd file to vector storeList files in vector storeRetrieve file in vector storeRemove file from vector storeCreate file batchRetrieve file batchList files in file batchCancel file batchSearch vector store
Create response

Chat completions API

POST
/chat/completions

Authorization

Authorization
Required
Bearer <token>

In: header

Request Body

application/jsonRequired

model
Required
string

The model alias or snapshot to use for the chat completion. We recommend using a stable alias unless you need to pin a specific model version.

Value in: "solar-pro-4" | "solar-pro-4-260806" | "solar-mini-4" | "solar-mini-4-260922" | "solar-pro4" | "solar-pro4-260806" | "solar-pro-4-contributor" | "solar-pro-4-260806-contributor" | "solar-mini4" | "solar-mini4-260922" | "solar-mini-4-5-preview" | "syn-pro" | "syn-pro-251021"

messages
Required
array<object>

A list of messages comprising the conversation so far.

reasoning_effortstringnull

An optional parameter that controls how much reasoning a model does before it answers. Support, accepted values, and behavior when omitted depend on the selected model. The request schema applies model-specific constraints for current Solar model families. Learn more in the Reasoning guide.

ModelOmittedReasoning offReasoning onVisible reasoning text
solar-pro-4Offnone, minimallow, medium, high, xhigh, maxReturned
solar-pro-4-contributorOffnone, minimallow, medium, high, xhigh, maxReturned
solar-mini-4Offnone, minimallow, medium, high, xhigh, maxReturned
solar-mini-4-5-previewOffnonelow, medium, high, xhigh, maxReturned

For solar-pro-4, solar-pro-4-contributor, solar-mini-4, and solar-mini-4-5-preview, an explicit null behaves the same as omitting the parameter and leaves reasoning off; send a value between low and max to turn reasoning on.

When a model returns visible reasoning text, it appears in choices[].message.reasoning for a non-streaming response and in choices[].delta.reasoning for streaming chunks. Reasoning tokens are reported in usage.completion_tokens_details.reasoning_tokens even for models that do not return the reasoning text itself.

A higher effort can increase token usage, latency, and cost, and does not guarantee a better answer.

Value in: null | "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max"

max_tokensinteger

An optional parameter that limits the maximum number of tokens to generate. If max_tokens is set, sum of input tokens and max_tokens should be lower than or equal to context length of model.

Default: "inf"

streamboolean

An optional parameter that specifies whether a response should be sent as a stream. If set to true, partial message deltas will be sent. Tokens will be sent as data-only server-sent events.

Default: falseValue in: true | false

stream_optionsobject

An optional object with settings that apply when stream is true.

temperaturenumber

An optional parameter to set the sampling temperature. The value should lie between 0 and 2. Higher values like 0.8 result in a more random output, whereas lower values such as 0.2 enhance focus and determinism in the output.

Defaults to 1.0 for solar-pro-4.

Default: 1Minimum: 0Maximum: 2Format: "float"

top_pnumber

An optional parameter to trigger nucleus sampling. The tokens with top_p probability mass will be considered, which means, setting this value to 0.1 will consider tokens comprising the top 10% probability.

Default: 1Minimum: 0Maximum: 1Format: "float"

frequency_penaltynumber

An optional parameter that controls the model’s tendency to repeat tokens. The value ranges from ​-2.0 to 2.0​.

  • Positive values (e.g., 1.5) increase the penalty for repeating tokens, reducing redundancy and encouraging diversity in the output.
  • Negative values (e.g., -1.0) decrease the penalty, allowing the model to repeat words or phrases more freely, which can be useful for stylistic emphasis or specific formatting needs.
  • A value of 0 applies no penalty, letting the model generate text based purely on its learned patterns.

This parameter is especially effective in balancing creativity and coherence in longer outputs.

Default: 1.1Minimum: -2Maximum: 2Format: "float"

presence_penaltynumber

An optional parameter that adjusts the model’s tendency to include tokens already present in the input or generated text. The value ranges from ​-2.0 to 2.0​.

  • Positive values (e.g., 1.5) penalize the inclusion of any tokens that have already appeared, reducing redundancy and steering the output toward new ideas or topics.
  • Negative values (e.g., -1.0) lower the penalty, encouraging the model to revisit or emphasize existing tokens, which can help maintain consistency or focus on specific themes.
  • A value of 0 applies no penalty, letting the model generate text without bias toward or against repeated tokens.

This parameter is useful for controlling coherence (e.g., avoiding topic drift with positive values) or reinforcing key concepts (e.g., with negative values in summaries or creative writing). Unlike frequency_penalty, it focuses on the presence of tokens rather than their repetition frequency.

Default: 0Minimum: -2Maximum: 2Format: "float"

toolsarraynull

A list of tools the model may call. Currently, only functions are supported as a tool. Learn more in the Tool calling guide.. Use this to provide a list of functions the model may generate JSON inputs for.

tool_choicestring | object

Controls which (if any) tool is called by the model.

  • none means the model will not call any tool and instead generates a message.
  • auto means the model can pick between generating a message or calling one or more tools.
  • required means the model must call one or more tools.
  • Specifying a particular tool via {"type": "function", "function": {"name": "my_function"}} forces the model to call that tool.

none is the default when no tools are present. auto is the default if tools are present.

parallel_tool_callsboolean

Whether to allow parallel function calling during tool use. When enabled, the model may generate multiple tool calls in a single response, allowing independent calls to run concurrently. This setting does not guarantee more than one tool call; process whatever tool_calls the model returns.

Default: true

response_formatJSON mode | Structured outputs

An object specifying the format that the model must generate. There are two modes.

  • JSON mode ({"type": "json_object"}) returns a JSON object without a schema. The conversation must include the word JSON somewhere, otherwise the request is rejected. This mode guarantees that the output parses as valid JSON, but not that it follows any particular shape, so the field names, types, and nesting can differ between calls.
  • Structured outputs ({"type": "json_schema", "json_schema": { ... }}) constrains the output to a JSON Schema that you supply, so every response comes back with the same fields, types, and enum values.

The current Solar aliases support json_schema. Learn more in the Structured outputs guide.

json_schema is required when type is json_schema, and is ignored otherwise. It must contain a name, strict set to true, and a schema. Following the OpenAI-compatible contract, every object in the schema must set additionalProperties to false and list all of its properties in required; make a value optional by adding null to its type instead of dropping it from required.

prompt_cache_keystring

An optional parameter that specifies a unique key for identifying and caching the prompt. Use a distinct key for each conversational context to improve cache utilization.

Default: null

Example

Request

# pip install openai

from openai import OpenAI # openai==1.52.2

client = OpenAI(
    api_key="UPSTAGE_API_KEY",
    base_url="https://api.upstage.ai/v1"
)

stream = client.chat.completions.create(
    model="solar-pro-4",
    messages=[
        {
            "role": "user",
            "content": "Hi, how are you?"
        }
    ],
    stream=True,
)

for chunk in stream:
    if chunk.choices[0].delta.content is not None:
        print(chunk.choices[0].delta.content, end="")

# Use with stream=False
# print(stream.choices[0].message.content)

Response

{
  "id": "75c4def7-5cc8-43eb-9558-545009063a3b",
  "object": "chat.completion",
  "created": 1785952894,
  "model": "solar-pro-4-260806",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! I'm doing well, thank you for asking. I'm an AI assistant, so I'm always ready to help you with whatever you need. How are you doing today? Is there anything specific I can assist you with?",
        "reasoning": "The user is asking a simple greeting question. I should respond warmly and briefly.\n"
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 57,
    "completion_tokens": 66,
    "total_tokens": 123,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "audio_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 17,
      "audio_tokens": 0,
      "accepted_prediction_tokens": 0,
      "rejected_prediction_tokens": 0
    }
  },
  "system_fingerprint": null
}

Responses

Generate responses with Upstage Responses API—OpenAI-compatible, with structured outputs, tool calling, reasoning items, and streaming events.

On this page

Chat completions APIExampleRequestResponse