Skip to main content

Official Python SDK for the Egune LLM API Gateway

Project description

Egune Python SDK

Official Python SDK for the Egune LLM API Gateway.

Installation

pip install egune

Quick Start

from egune import Egune

client = Egune(api_key="eg-xxx")

# Non-streaming
response = client.chat.completions.create(
    model="egune1-14b",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

# Streaming
stream = client.chat.completions.create(
    model="egune1-14b",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True,
)
for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

Async

from egune import AsyncEgune

client = AsyncEgune(api_key="eg-xxx")

response = await client.chat.completions.create(
    model="egune1-14b",
    messages=[{"role": "user", "content": "Hello!"}],
)

# Async streaming
stream = await client.chat.completions.create(
    model="egune1-14b",
    messages=[{"role": "user", "content": "Hello!"}],
    stream=True,
)
async for chunk in stream:
    if chunk.choices[0].delta.content:
        print(chunk.choices[0].delta.content, end="")

List Models

models = client.models.list()
for model in models.data:
    print(model.id)

Error Handling

from egune import Egune, EguneError

client = Egune(api_key="eg-xxx")

try:
    response = client.chat.completions.create(
        model="egune1-14b",
        messages=[{"role": "user", "content": "Hello!"}],
    )
except EguneError as e:
    print(f"Error: {e.message} (type={e.type}, code={e.code}, status={e.status})")

Configuration

client = Egune(
    api_key="eg-xxx",
    base_url="https://api.egune.com/v1",  # default
    timeout=600.0,                         # default, in seconds
)

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

egune-1.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

egune-1.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file egune-1.0.0.tar.gz.

File metadata

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

File hashes

Hashes for egune-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b203b74c7e6191f5834fe1e9936d3bd30cb24bc00859a4cae30b7ace3cf36488
MD5 33170d5f5170481340f9bfe1502da958
BLAKE2b-256 bb112bb4527912e5f94dacff179df23964124670ccad8dd3c9e9bb84aca48a16

See more details on using hashes here.

File details

Details for the file egune-1.0.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for egune-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f8afc4e92fa63ebcfd18b4cc6d92492f459c8a57f72446a6bf5d666b22234ba4
MD5 a965c6d78f584a5672e31acd5f842e2c
BLAKE2b-256 00e18367710ff1b91f71e9aeb7eed725a690f4626564fdf622a84e7cb1ab0ea1

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