Skip to main content

Official Python SDK for Cencori - AI Infrastructure for Production

Project description

Cencori Python SDK

Official Python SDK for Cencori - AI Infrastructure for Production.

Installation

pip install cencori

Quick Start

from cencori import Cencori

cencori = Cencori(api_key="your-api-key")

response = cencori.ai.chat(
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.content)

Streaming

for chunk in cencori.ai.chat_stream(
    messages=[{"role": "user", "content": "Tell me a story"}],
    model="gpt-4o"
):
    print(chunk.delta, end="", flush=True)

Error Handling

from cencori import (
    Cencori,
    AuthenticationError,
    RateLimitError,
    SafetyError
)

try:
    response = cencori.ai.chat(messages=[...])
except AuthenticationError:
    print("Invalid API key")
except RateLimitError:
    print("Too many requests")
except SafetyError as e:
    print(f"Content blocked: {e.reasons}")

Supported Models

Provider Models
OpenAI gpt-4o, gpt-4-turbo, gpt-3.5-turbo
Anthropic claude-3-opus, claude-3-sonnet, claude-3-haiku
Google gemini-2.5-flash, gemini-2.0-flash

License

MIT © FohnAI

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

cencori-0.1.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

cencori-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file cencori-0.1.0.tar.gz.

File metadata

  • Download URL: cencori-0.1.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for cencori-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d16a3b44ce9ecbadb300e8b0b516a9fb46cb7b65352de7950c4603e9f1fea3f1
MD5 69fa0ac29c869ec09b4d52e78aee8537
BLAKE2b-256 099bfd3211b96429ebcbff2722fa5a2bca9993784cd9e1b4d653bcaede3ee6a6

See more details on using hashes here.

File details

Details for the file cencori-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cencori-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for cencori-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0d5bc4c6aef00e163a801f0a374ab26d10dff5336a96164b809b52113d5d978
MD5 80acee28f3264bea85eb37bc930739bc
BLAKE2b-256 c4bae3d768a52be990b9ae7d30669966e2f1f6971a654cc1f9b994612a7271ba

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