Skip to main content

Private beta Python SDK for rate-limited AI API access

Project description

Neuroute

Private Beta Python SDK for rate-limited AI API access

📍 Coming back to this project? See STATUS.md for current progress and next steps.

This is a Python SDK that provides controlled access to AI capabilities for authorized users. It's designed for a small group of friends/users with strict rate limiting to keep costs manageable.

⚠️ Private Beta Notice

This SDK is not a public service. It's a private beta for a limited number of authorized users (max 10). Access requires an API key distributed by the service administrator.

Installation

pip install neuroute

Quick Start

from neuroute import NeurouteClient

# Initialize client with your API key
client = NeurouteClient(api_key="csk_your_api_key_here")

# Send query
response = client.query("What is Python?")
print(response)

Rate Limits & Constraints

  • 1 query per hour per user
  • 100 character maximum per query
  • 150 tokens maximum output (enforced server-side)

Error Handling

from neuroute import (
    NeurouteClient,
    RateLimitExceededError,
    QueryTooLongError,
    InvalidAPIKeyError,
    ServiceDisabledError
)

client = NeurouteClient(api_key="your_key")

try:
    response = client.query("Explain recursion")
    print(response)

except RateLimitExceededError as e:
    print(f"Rate limit hit! Wait {e.retry_after_seconds} seconds")

except QueryTooLongError:
    print("Query too long (max 100 characters)")

except InvalidAPIKeyError:
    print("Invalid or inactive API key")

except ServiceDisabledError:
    print("Service temporarily disabled")

API Key Security

IMPORTANT: Treat your API key like a password:

  • ✅ Store it in environment variables
  • ✅ Never commit it to git
  • ✅ Never share it publicly
  • ❌ Don't hardcode it in your scripts

Best practice:

import os
from neuroute import NeurouteClient

api_key = os.getenv("NEUROUTE_API_KEY")
client = NeurouteClient(api_key=api_key)

Example Use Cases

Simple Query

client = NeurouteClient(api_key="your_key")
answer = client.query("What is recursion?")
print(answer)

With Retry Logic

import time
from neuroute import NeurouteClient, RateLimitExceededError

client = NeurouteClient(api_key="your_key")

def query_with_retry(prompt, max_retries=3):
    for attempt in range(max_retries):
        try:
            return client.query(prompt)
        except RateLimitExceededError as e:
            if attempt < max_retries - 1:
                print(f"Rate limited. Waiting {e.retry_after_seconds} seconds...")
                time.sleep(e.retry_after_seconds)
            else:
                raise

response = query_with_retry("What is Python?")
print(response)

Limitations

  • Single query per hour (3600 seconds)
  • Query length capped at 100 characters
  • Output capped at 150 tokens (~100-120 words)
  • Service may be disabled temporarily for maintenance
  • This is a private beta - service can be terminated anytime

Getting an API Key

API keys are manually distributed by the service administrator. If you don't have a key, contact the administrator directly.

Each key is limited to 1 query per hour and can be revoked at any time.

Support

Since this is a private beta for friends:

  • Contact the administrator directly for support
  • Check the GitHub repository for documentation
  • Report issues privately to the administrator

License

MIT License - See LICENSE file for details


Note: This SDK is designed for personal/educational use with strict rate limits.

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

neuroute-0.2.0.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

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

neuroute-0.2.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file neuroute-0.2.0.tar.gz.

File metadata

  • Download URL: neuroute-0.2.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for neuroute-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2fc825c6d19e30b7e4104fa1107be959c8b0c04e093a32bc28935c1d2ef28f2a
MD5 cf53b188a58d32654369ad2f88db351b
BLAKE2b-256 3ebbd6c3dc872dbc4b07a69ea7c90e3b144461953186721533c51889c2553460

See more details on using hashes here.

File details

Details for the file neuroute-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: neuroute-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for neuroute-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a108ee2bb3f8687c9d89e934708e150983f67225c6fccc95c473edc9d93f1628
MD5 51fbdaf63ef78459cdf2679d643f251f
BLAKE2b-256 23adcb1cb8fd47acda5789cc6dabb69582f0163e6ec251f2959a32b4f2d1090e

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