Documentation API Reference Playground Dashboard
API keysBilling

API keys

Example codes
# 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",
    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)

🎉

Sign up to receive $10 free credit!

Welcome to
the Upstage console

Don't have an account?

OR
Terms of use | Privacy policy
    Overview
    Oops! Something went wrong. Please try again in a few minutes.