> For the complete documentation index, see [/llms.txt](/llms.txt).

> Source: /docs/getting-started

<h1>Let's build something great today.</h1>

Here, you can discover production-ready AI models developed by Upstage, to build your applications with ease.
If you're looking to leverage LLMs for complex document tasks—such as building a document QA service or extracting key information—you’ve come to the right place.
Concerned about privacy? Rest assured, we do not store or reuse any data sent to our APIs, unless you opt in to [contributor mode](/docs/guides/contributor-mode). For more details, check our [terms](/docs/resources/terms-and-policies/terms-of-use).

## Start building

### Sign up

To sign up, press the `Log in` button at the upper right of this page.

### Get an API key

To get an API key, just click the `Create new key` below. You can view keys in the [API keys page](/api-keys).

### Make an API request

Choose a capability from the menu and make an API request using the provided example code.
Each capability includes a ready-to-use code snippet.
For AI agents, use the machine-readable docs index at [/llms.txt](/llms.txt).

**Chat with Reasoning** (Python)

```python
from openai import OpenAI

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

response = client.chat.completions.create(
    model="solar-pro-4",
    messages=[
        {
            "role": "user",
            "content": "An $80 item gets a 20% discount, then 10% tax is added. What is the final price? Answer with only the dollar amount."
        }
    ],
    reasoning_effort="medium"
)

message = response.choices[0].message

reasoning = getattr(message, "reasoning", None)
if reasoning:
    print(reasoning)

print(message.content)
```

**Document parsing** (Python)

```python
# pip install requests

import requests

api_key = "UPSTAGE_API_KEY"  # ex: up_xxxYYYzzzAAAbbbCCC
filename = "YOUR_FILE_NAME"  # ex: ./image.png

url = "https://api.upstage.ai/v1/document-digitization"
headers = {"Authorization": f"Bearer {api_key}"}
files = {"document": open(filename, "rb")}
data = {"ocr": "force", "base64_encoding": "['table']", "model": "document-parse"}
response = requests.post(url, headers=headers, files=files, data=data)

print(response.json())
```

**Universal extraction** (Python)

```python
# pip install openai
import base64
import json
from openai import OpenAI

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

def encode_img_to_base64(img_path):
    with open(img_path, 'rb') as img_file:
        img_bytes = img_file.read()
        base64_data = base64.b64encode(img_bytes).decode('utf-8')
        return base64_data
 
# Read the image file and encode it to base64
filepath = "./bank_statement.png"
base64_data = encode_img_to_base64(filepath)

# Information Extraction Request using the generated schema
extraction_response = client.chat.completions.create(
    model="information-extract",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "image_url",
                    "image_url": {"url": f"data:application/octet-stream;base64,{base64_data}"}
                }
            ]
        }
    ],
    response_format={
        "type": "json_schema",
        "json_schema": {
            "name": "document_schema",
            "schema": {
                "type": "object",
                "properties": {
                    "bank_name": {
                        "type": "string",
                        "description": "The name of bank in bank statement"
                    }
                }
            }
        }
    }
)
 
print(extraction_response)
```

**Document classification** (Python)

```python
# pip install openai
import base64
import json
from openai import OpenAI

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

def encode_img_to_base64(img_path):
    with open(img_path, 'rb') as img_file:
        img_bytes = img_file.read()
        base64_data = base64.b64encode(img_bytes).decode('utf-8')
        return base64_data

filepath = "./your_document.png"
base64_data = encode_img_to_base64(filepath)

response = client.chat.completions.create(
    model="document-classify",
    messages=[
        {
            "role": "user",
            "content": [
                {
                    "type": "image_url",
                    "image_url": {"url": f"data:application/octet-stream;base64,{base64_data}"}
                }
            ]
        }
    ],
    response_format={
        "type": "json_schema",
        "json_schema": {
            "name": "document-classify",
            "schema": {
                "type": "string",
                "oneOf": [
                    {"const": "invoice", "description": "Commercial invoice with itemized charges and billing information"},
                    {"const": "receipt", "description": "Receipt showing purchase transaction details"},
                    {"const": "contract", "description": "Legal agreement or contract document"},
                    {"const": "cv", "description": "Curriculum vitae or resume"},
                    {"const": "others", "description": "Other"}
                ]
            }
        }
    }
)

print(response)
```

**Embeddings** (Python)

```python
# 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"
)

response = client.embeddings.create(
    input="Solar embeddings are awesome",
    model="solar-embedding-2-query"
)

print(response.data[0].embedding)
```

## Continue with paid usage

Choose how to pay for your API usage.

Pay-as-you-go — Pay after you use

No need to buy credits. We charge your registered payment method each month for your usage.

[Add a payment method →](/billing/payment)

Prepaid credits — Pay before you use

Buy credits in advance. Buying credits can also raise your [rate limit](/docs/guides/rate-limits).

[Buy credits →](/billing/credit)

For details, see the [billing FAQ](/docs/resources/faq#how-are-the-charges-for-the-service-billed).

## Explore our offerings

Upstage provides a diverse range of AI capabilities, each designed to address specific needs across various workflows.

Studio API — Create and run reusable document-processing workflows.

Chat — Chat with a family of small yet powerful LLMs.

Document parsing — Convert complex documents into LLM-readable formats.

Information extraction — Extract key-values from target documents with high precision.

Document classification — Classify documents into predefined categories.

Embeddings — Convert text to vector representations for advanced search applications.

## Have questions?

Please visit the following resources for assistance!

- [FAQ](/docs/resources/faq)
- [Support center](https://support.upstage.ai)

<figure><a href="https://www.aicpa-cima.com/resources/download/soc-for-service-organizations-engagements-overview" target="_blank" rel="noopener noreferrer"><img src="/assets/images/docs/logo/soc.png" alt="soc.png" width="80" height="80" /></a><img src="/assets/images/docs/logo/hippa.png" alt="hippa.png" width="80" height="80" /><img src="/assets/images/docs/logo/bsi.png" alt="bsi.png" /></figure>