Skip to content

OpenAI Official SDK Usage Guide

TIP

Our API is fully compatible with the OpenAI API protocol and can be seamlessly integrated with applications that support the OpenAI API. Note: All chat models (including non-OpenAI models) are compatible with the official OpenAI SDK. Please follow OpenAI's request URLs and formats. Reference: OpenAI Documentation

Claude models support both the official OpenAI-compatible format and Claude's native format.

When making requests, replace https://api.openai.com with our API base URL (check the API address in the site's API Console). Make sure the API key you use belongs to the same site/API address — mixing keys and endpoints from different sites will cause failures.

OpenAI Python SDK

Repository ⚠️ Note: Please upgrade the openai package to version 1.25+ (or the latest) to avoid calling errors.

Install

sh
pip install openai

Example Request

Note: base_url should include the /v1/ suffix.

python
import os
import openai

openai.api_key = "YOUR_API_KEY"

# Example: set base URL to this site's API (include /v1/)
openai.base_url = "https://api.gpt.ge/v1/"
openai.default_headers = {"x-foo": "true"}

completion = openai.chat.completions.create(
    model="gpt-4.1-mini",
    messages=[
        {
            "role": "user",
            "content": "Hello world!",
        },
    ],
)
print(completion.choices[0].message.content)

# Typical output: "Hello there! How can I assist you today?"

OpenAI Node SDK

Repository ⚠️ Note: Please upgrade the openai package to the latest version to avoid calling errors.

Install

sh
npm install openai

Example Request

Note: basePath should include the /v1 suffix.

js
const { Configuration, OpenAIApi } = require("openai");

const configuration = new Configuration({
  apiKey: "YOUR_API_KEY",
  basePath: "https://api.gpt.ge/v1"
});
const openai = new OpenAIApi(configuration);

const chatCompletion = await openai.createChatCompletion({
  model: "gpt-3.5-turbo",
  messages: [{ role: "user", content: "Hello world" }],
});

console.log(chatCompletion.data.choices[0].message.content);