# 🐍 Nexus Gateway Python SDK

The official Python client for **Nexus Gateway**.

This library provides a simple interface to interact with the Nexus Gateway API, enabling semantic caching, multi-model routing, and automated cost optimization for LLM applications.

**New in v0.1.7:** Interactive CLI and Real-time Streaming support.


## Installation

You can install the package via pip:

```bash
pip install nexus-gateway

```
# CLI TOOL(NEW)
You can use Nexus Gateway directly from your terminal without writing code.

```bash
nexus
```
This launches an interactive, streaming chat session in your terminal.


# Authentication
You need a valid API Key to use this client.
[Get your Free API Key here](https://nexus-gateway.org)

#  Usage (Python Code)

1. Basic Chat
```
from nexus_gateway import NexusClient

client = NexusClient(api_key="nk-your-key-here")

response = client.chat("Explain quantum computing.")
print(response)
```

 2. Real-Time Streaming (ChatGPT Style)
 ```
 # Set stream=True to get chunks of text as they arrive
for chunk in client.chat("Tell me a story", stream=True):
    print(chunk, end="", flush=True)
```

# Switching Models (The Universal Router)
```
Nexus Gateway supports multiple AI providers. You can switch models instantly without changing your code structure.

# Use Anthropic Claude 3
client.chat("Hello", model="claude-3-opus-20240229")

# Use OpenAI GPT-4
client.chat("Hello", model="gpt-4")

```
# Key Feature
    *  Semantic Caching: Automatically caches responses in Vector DB. Identical or similar queries return instantly.
    *  Universal API: One interface for OpenAI and Anthropic.
    *  Rate Limiting: Built-in protection against spam or API abuse.
    *  Automated Billing: Usage is tracked automatically via the gateway.
    *  Cost Savings: Reduces API bills by serving cached hits.
License
MIT License © 2025 Sunny Anand
