Skip to main content

Python SDK for Shakti LLM API - OpenAI compatible

Project description

DevShakti AI SDK

Python SDK for Shakti AI - An OpenAI-compatible LLM API.

🚀 Installation

pip install devshakti-ai

📚 Documentation

Full documentation, interactive playground, and API reference available at:

🔗 https://shakti-one.vercel.app

⚡ Quick Start

from shakti import ChatShakti
import json

# Initialize client
client = ChatShakti(api_key="sk-your-api-key")

# Simple completion
response = client.chat.completions.create(
    messages=[{"role": "user", "content": "Hello"}]
)
print(response['choices'][0]['message']['content'])

🎯 Streaming Example

from shakti import ChatShakti
import json

client = ChatShakti(api_key="sk-your-api-key")

# Streaming response
for chunk in client.chat.completions.create(
    messages=[{"role": "user", "content": "Tell me a story"}],
    stream=True
):
    chunk_dict = json.loads(chunk)
    content = chunk_dict['choices'][0]['delta'].get('content', '')
    if content:
        print(content, end='', flush=True)

🎨 Custom Configuration

from shakti import ChatShakti

# Custom base URL and parameters
client = ChatShakti(
    api_key="sk-your-api-key",
    base_url="https://devshakti.serveo.net"  # Optional
)

response = client.chat.completions.create(
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello!"}
    ],
    model="shakti-01-chat",
    temperature=0.7,
    max_tokens=1024,
    stream=False
)

✨ Features

  • OpenAI-compatible API - Easy migration from OpenAI
  • Streaming support - Real-time token streaming
  • Simple Python interface - Clean, intuitive SDK
  • Free tier available - Get started at no cost
  • Fast responses - 2-3 second average latency
  • Rate limiting - 60 requests/min, 150k tokens/min

🔧 API Endpoints

  • Base URL: https://devshakti.serveo.net
  • Chat Completions: /v1/chat/completions
  • Models: /v1/models
  • Health Check: /health

📝 Basic Usage

Simple Request

response = client.chat.completions.create(
    messages=[{"role": "user", "content": "What is Python?"}]
)

With System Prompt

response = client.chat.completions.create(
    messages=[
        {"role": "system", "content": "You are a coding expert."},
        {"role": "user", "content": "Explain async/await"}
    ]
)

Streaming Tokens

for chunk in client.chat.completions.create(
    messages=[{"role": "user", "content": "Write a poem"}],
    stream=True
):
    # Process each token as it arrives
    chunk_dict = json.loads(chunk)
    content = chunk_dict['choices'][0]['delta'].get('content', '')
    if content:
        print(content, end='', flush=True)

🔑 Get Your API Key

Visit https://shakti-one.vercel.app to:

  • 🔐 Generate your free API key
  • 🎮 Try the interactive playground
  • 📖 Read full documentation
  • 💻 See more code examples

📊 Rate Limits

  • Requests: 60 per minute
  • Tokens: 150,000 per minute
  • Concurrent: 10 requests

🛠️ Requirements

  • Python 3.7+
  • requests library (installed automatically)

🤝 Support

📄 License

MIT License - See LICENSE file for details.

🌟 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Made with ❤️ by Shivnath Tathe

Get Started →

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

devshakti_ai-0.1.2.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

devshakti_ai-0.1.2-py2.py3-none-any.whl (6.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file devshakti_ai-0.1.2.tar.gz.

File metadata

  • Download URL: devshakti_ai-0.1.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for devshakti_ai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 04000b606c6730ada0eedfebf86869fa9ad9570ece9e9abbe5c0364eee4f1d98
MD5 821a0a3759dfd72f060909f83e49a771
BLAKE2b-256 aa8f6b1e95e196c354a4e280575b4165b58e29e5290edc4c961a895f3af1b449

See more details on using hashes here.

File details

Details for the file devshakti_ai-0.1.2-py2.py3-none-any.whl.

File metadata

  • Download URL: devshakti_ai-0.1.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for devshakti_ai-0.1.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 04ce340c0dbd43121a502c69b7231760704dfc0fa0deb9e1ccbf452d9e058fa7
MD5 a3e4358ade315447010b0174066ed67f
BLAKE2b-256 ae9318a02bd734ed019dcaece2a3392e6e04e504604c7f9e61df506bc7915d63

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