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

Embeddings API


Example

Request

# pip install openai

from openai import OpenAI # openai==1.52.2

client = OpenAI(
    api_key="UPSTAGE_API_KEY_INJECT",
    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)

Response

Success - HTTP Status 200 OK - Single input response

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [
        0.01850688,
        -0.0066606696,
        ...
        0.009938696,
        0.006452979
      ]
    }
  ],
  "model": "solar-embedding-2-query",
  "usage": {
    "prompt_tokens": 21,
    "total_tokens": 21
  }
}

Document classification

Classify documents into user-defined types without templates or retraining — request parameters, examples, and response format.

Create workflow

Create a workflow to save and reuse document processing settings.

On this page

Embeddings APIExampleRequestResponse
    POST
    /embeddings
    /embeddings

    The Authorization access token

    input*

    Authorization

    Authorization
    Required
    Bearer <token>

    In: header

    Request Body

    application/jsonRequired

    model
    Required
    string

    An parameter that specifies the model version to be used. We recommend using the aliases, which always points to the latest stable model. You may also specify a particular model version, but please note that models are frequently updated, and services tied to specific versions may be affected when those versions are deprecated. Available snapshot models are listed in the capabilities document.

    input
    Required
    string | array<string>

    Input text to embed. A single string or an array of strings are allowed.

    • The array can contain up to 100 strings, and the total number of tokens in the array(tokens per each request) should be less than 204,800.
    • Each input string must not exceed 4000 input tokens for the model, and cannot be an empty string.
    • We advise keeping each text under 512 tokens in length for the optimal user experience.