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
  • threads
  • usage
  • audio.transcriptions
  • music.youtube
  • music.yandex
  • sync and async clients

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.xyz",
    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.3.tar.gz (11.5 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.3-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: titangpt-0.2.3.tar.gz
  • Upload date:
  • Size: 11.5 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.3.tar.gz
Algorithm Hash digest
SHA256 c85d1ed79284d927d9a4bab4c67a8783034ddd57837d567ccb07fb23658dac62
MD5 5f82559f869b84151e68b57a69beec64
BLAKE2b-256 f24a34defe971bf2309e45d32928fadb538fae49de095b8c8fcdc5a9f29893fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: titangpt-0.2.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 875f300cc20418a509e6e1ea3904202d6e385b20b8edfd703260d64016d3dfbc
MD5 a0498cbd742d0d6a4d9349a5136bacd2
BLAKE2b-256 d1c5bf092f8db9667a65115f8dc1a7780bfd4e9666db59093883b53b497ed044

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