SovrGPT Docs
API

SDK examples

Use SovrGPT with the OpenAI SDKs: examples for Python, Node.js, .NET, Java and Go, plus Vercel AI SDK, LangChain and LiteLLM, each with base URL and key.

SovrGPT speaks the OpenAI v1 schema. You can use the common OpenAI SDKs as they are and only change baseURL and apiKey. The examples use gemma-4-12b; other IDs come from GET /v1/models.

Python (official openai SDK)

from openai import OpenAI

client = OpenAI(
    api_key="sov_…",
    base_url="https://sovrgpt.com/api/v1",
)

resp = client.chat.completions.create(
    model="gemma-4-12b",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)

Streaming:

for chunk in client.chat.completions.create(
    model="gemma-4-12b",
    messages=[{"role": "user", "content": "Tell me a joke."}],
    stream=True,
):
    print(chunk.choices[0].delta.content or "", end="", flush=True)

Node.js (official openai SDK)

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.SOVR_KEY,
  baseURL: "https://sovrgpt.com/api/v1",
});

const resp = await client.chat.completions.create({
  model: "gemma-4-12b",
  messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);

Vercel AI SDK

import { createOpenAI } from "@ai-sdk/openai";
import { streamText } from "ai";

const sovrgpt = createOpenAI({
  apiKey: process.env.SOVR_KEY!,
  baseURL: "https://sovrgpt.com/api/v1",
});

const result = streamText({
  model: sovrgpt("gemma-4-12b"),
  messages: [{ role: "user", content: "Hello!" }],
});

for await (const textPart of result.textStream) {
  process.stdout.write(textPart);
}

.NET (official OpenAI package)

using OpenAI.Chat;

var client = new ChatClient(
    model: "gemma-4-12b",
    credential: new System.ClientModel.ApiKeyCredential("sov_…"),
    options: new()
    {
        Endpoint = new Uri("https://sovrgpt.com/api/v1"),
    });

var resp = await client.CompleteChatAsync(
    new UserChatMessage("Hello!"));
Console.WriteLine(resp.Value.Content[0].Text);

Java (langchain4j)

OpenAiChatModel model = OpenAiChatModel.builder()
    .apiKey(System.getenv("SOVR_KEY"))
    .baseUrl("https://sovrgpt.com/api/v1")
    .modelName("gemma-4-12b")
    .build();

String answer = model.generate("Hello!");
System.out.println(answer);

Go (sashabaranov/go-openai)

client := openai.NewClientWithConfig(openai.ClientConfig{
    AuthToken: os.Getenv("SOVR_KEY"),
    BaseURL:   "https://sovrgpt.com/api/v1",
})

resp, _ := client.CreateChatCompletion(ctx, openai.ChatCompletionRequest{
    Model:    "gemma-4-12b",
    Messages: []openai.ChatCompletionMessage{{Role: "user", Content: "Hello!"}},
})
fmt.Println(resp.Choices[0].Message.Content)

LangChain (Python)

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="gemma-4-12b",
    api_key="sov_…",
    base_url="https://sovrgpt.com/api/v1",
)

print(llm.invoke("Hello!").content)

LiteLLM

import litellm
litellm.api_base = "https://sovrgpt.com/api/v1"
litellm.api_key = "sov_…"

resp = litellm.completion(
    model="openai/gemma-4-12b",
    messages=[{"role": "user", "content": "Hello!"}],
)

LiteLLM needs the openai/ prefix for OpenAI-compatible providers.

SDK examples