Skip to main content

Official Python client for the TitanGPT API

Project description

TitanGPT Python Client

PyPI version License: MIT

Official Python SDK for the TitanGPT API.

Public API

The package includes:

  • chat.completions
  • models.list
  • files
  • moderations
  • threads
  • usage
  • audio.transcriptions
  • music.youtube
  • music.yandex
  • sync and async clients

images has been removed from the public SDK surface.

Installation

pip install titangpt

Python 3.8+ is supported.

Quick Start

Sync Client

from titangpt import TitanGPT

with TitanGPT(api_key="YOUR_API_KEY") as client:
    response = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": "Explain quantum physics in one sentence."},
        ],
    )

    print(response.choices[0].message.content)

Async Client

import asyncio

from titangpt import AsyncTitanGPT


async def main():
    async with AsyncTitanGPT(api_key="YOUR_API_KEY") as client:
        response = await client.chat.completions.create(
            model="gpt-4o-mini",
            messages=[{"role": "user", "content": "Write a haiku about Python."}],
        )
        print(response.choices[0].message.content)


asyncio.run(main())

Configuration

client = TitanGPT(
    api_key="YOUR_API_KEY",
    base_url="https://api.titangpt.ru",
    timeout=60,
    max_retries=3,
    user_id="12345",
    product="api",
)

Build

python -m build
python -m twine check dist/*

Links

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

titangpt-0.2.2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

titangpt-0.2.2-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file titangpt-0.2.2.tar.gz.

File metadata

  • Download URL: titangpt-0.2.2.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for titangpt-0.2.2.tar.gz
Algorithm Hash digest
SHA256 6ff020884255972df0e63e2811382607b61123a10116de618d614d333f131ebb
MD5 150d2fcf844e6af883d34839ebf808a8
BLAKE2b-256 e0c92195a42b5da390feeb9cddb7b8fb066b7175f6fb1af47deddc8b5e6ce692

See more details on using hashes here.

File details

Details for the file titangpt-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: titangpt-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 14.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for titangpt-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 58ab9f026935f17d05f49b47f2ac3d98e3bf134326ad8db9a13bce411189d504
MD5 c0e5f7eb05ce75438de8231c0b9ccfb1
BLAKE2b-256 fc7fc986fa2db80036c0dfb8680e5a5ecdd375aff4ae4b7b1a2f994b096fb09b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page