Skip to main content

Private beta Python SDK for rate-limited Claude API access

Project description

Neuroute

Private Beta Python SDK for rate-limited Claude 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 Claude AI 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 ClaudeClient

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

# Query Claude
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 (
    ClaudeClient,
    RateLimitExceededError,
    QueryTooLongError,
    InvalidAPIKeyError,
    ServiceDisabledError
)

client = ClaudeClient(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 ClaudeClient

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

Example Use Cases

Simple Query

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

With Retry Logic

import time
from neuroute import ClaudeClient, RateLimitExceededError

client = ClaudeClient(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 a wrapper around the Anthropic Claude API. It's designed for personal/educational use with strict rate limits. For production use, consider using the official Anthropic API directly.

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.1.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.1.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neuroute-0.1.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.1.0.tar.gz
Algorithm Hash digest
SHA256 cf175132fc44df0a8c7873ca533e7dc8721e6836f0b4cc68cb1a6a896595fdce
MD5 82c6196cdc2e9b137bdf7a41af35fb04
BLAKE2b-256 e34e8e2d142ecd6930d4e913731acedf0be1e9fc01ad63a9a36fc468d5eabcc7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuroute-0.1.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f7bbb0f66bcf835902ba6ec952fcefe9455bebbd555a86bfbbd1de0e6b5ea9e
MD5 2801c22b8c08d2a572eb5e78f9b3f5c7
BLAKE2b-256 3b2e2ecb74d013a548e03d84572bdbf1f405611819bf75c11acc4655c717bb95

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