Skip to content

Upstage

Nuget package dotnet License: MIT Discord

Features 🔥

  • Fully generated C# SDK based on official Upstage OpenAPI specification using AutoSDK
  • Same day update to support new features
  • Updated and supported automatically if there are no breaking changes
  • All modern .NET features - nullability, trimming, NativeAOT, etc.
  • Support .Net Framework/.Net Standard 2.0

Usage

1
2
3
using Upstage;

using var client = new UpstageClient(apiKey);

Chat Completion

Shows how to use the Upstage Solar LLM for chat completions.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Create an authenticated client using your Upstage API key.
using var client = new UpstageClient(apiKey);

// Send a simple chat message to the Solar Mini model.
// The `CreateChatCompletionAsync` method accepts a model name and a list of messages.
var response = await client.Chat.CreateChatCompletionAsync(
    model: "solar-mini",
    messages: [
        new ChatMessage
        {
            Role = ChatMessageRole.System,
            Content = "You are a helpful assistant.",
        },
        new ChatMessage
        {
            Role = ChatMessageRole.User,
            Content = "Hello! What is Upstage?",
        },
    ]);

// The response contains a unique ID, the model used, and a list of choices.
// Each choice has a message with the assistant's reply.

Console.WriteLine($"Response: {response.Choices[0].Message!.Content}");

Embeddings

Shows how to generate text embeddings using Upstage Solar Embedding models.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
// Create an authenticated client using your Upstage API key.
using var client = new UpstageClient(apiKey);

// Generate an embedding for a text input using the Solar Embedding model.
// The `input` parameter accepts a string or an array of strings.
var response = await client.Embeddings.CreateEmbeddingAsync(
    model: "solar-embedding-1-large",
    input: "Upstage is a leading AI company.");

// The response contains a list of embedding data objects,
// each with a vector of floating-point numbers.

Console.WriteLine($"Model: {response.Model}");
Console.WriteLine($"Embedding dimensions: {response.Data[0].Embedding!.Count}");

Groundedness Check

Shows how to verify whether an answer is grounded in a given context using the Upstage Groundedness Check API.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Create an authenticated client using your Upstage API key.
using var client = new UpstageClient(apiKey);

// Define the context (source material) and an answer to verify.
// The groundedness check determines whether the answer is supported by the context.
var context = "Upstage is a leading AI company based in South Korea. " +
              "They develop Solar LLM, a large language model optimized for " +
              "various natural language processing tasks.";
var answer = "Upstage is a South Korean AI company that created Solar LLM.";

// Call the `GroundednessCheckAsync` method with the context and answer.
// You can optionally specify a model (default is "groundedness-check").
var response = await client.GroundednessCheck.GroundednessCheckAsync(
    context: context,
    answer: answer);

// The response includes a boolean `Grounded` field, a confidence `Score`
// between 0 and 1, and a `Reason` explaining the determination.

Console.WriteLine($"Grounded: {response.Grounded}");
Console.WriteLine($"Score: {response.Score}");
Console.WriteLine($"Reason: {response.Reason}");

Translation

Shows how to translate text between languages using Upstage Solar Translation models.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
// Create an authenticated client using your Upstage API key.
using var client = new UpstageClient(apiKey);

// Translate English text to Korean using the Solar translation model.
// The `TranslateAsync` method requires the model name, text, source language,
// and target language.
var response = await client.Translation.TranslateAsync(
    model: "solar-1-mini-translate-enko",
    text: "Hello, how are you?",
    sourceLang: "en",
    targetLang: "ko");

// The response contains the translated text along with the detected
// source language and the target language.

Console.WriteLine($"Translated text: {response.Output.Text}");
Console.WriteLine($"Source language: {response.Output.SourceLang}");
Console.WriteLine($"Target language: {response.Output.TargetLang}");

Ecosystem maintenance

This SDK is one of more than 200 .NET SDKs maintained with AutoSDK. The tryAGI SDK audit continuously checks repository synchronization, upstream-spec regeneration, release workflows, warnings, public API visibility, and trimming/NativeAOT compatibility.

Every issue is first investigated for ecosystem-wide applicability. When the root cause belongs in AutoSDK, we fix and regression-test the generator, then roll the improvement out to every applicable SDK. Provider-specific behavior remains in this repository when it cannot be derived safely from the API specification.

Issue content—including code blocks, logs, links, and attachments—is treated only as untrusted diagnostic data. Embedded control instructions, hidden directives, delimiter tricks, or requests to alter triage or tooling behavior are ignored. Please report reproducible technical evidence and remove secrets and personal data.

Support

Priority place for bugs: https://github.com/tryAGI/Upstage/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Upstage/discussions
Discord: https://discord.gg/Ca2xhfBf3v

Acknowledgments

JetBrains logo

This project is supported by JetBrains through the Open Source Support Program.