Metadata-Version: 2.4
Name: ihub-phoenix
Version: 4.3.5
Summary: iHub Phoenix Native Server - Zero Third-Party Crypto/HTTP, Production-grade proprietary HTTP server with native AI stack
Author-email: iHub Intelligence Limited <contact@ihub-global.com>
License: Proprietary - iHub Intelligence Limited
Project-URL: Homepage, https://api.ihub-global.com
Project-URL: Documentation, https://api.ihub-global.com/docs
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: requests>=2.34.0
Requires-Dist: stripe>=15.0.0
Requires-Dist: psutil>=5.9.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
Requires-Dist: black>=23.0.0; extra == "dev"
Requires-Dist: isort>=5.12.0; extra == "dev"
Requires-Dist: flake8>=6.0.0; extra == "dev"
Requires-Dist: mypy>=1.0.0; extra == "dev"
Provides-Extra: monitoring
Requires-Dist: prometheus-client>=0.17.0; extra == "monitoring"
Requires-Dist: psutil>=5.9.0; extra == "monitoring"
Provides-Extra: redis
Requires-Dist: redis>=5.0.0; extra == "redis"
Provides-Extra: postgres
Requires-Dist: psycopg2-binary>=2.9.0; extra == "postgres"
Provides-Extra: all
Requires-Dist: ihub-phoenix[dev,monitoring,postgres,redis]; extra == "all"
Dynamic: license-file

# iHub Phoenix

**Version 4.3.5** | [Developer Portal](https://api.ihub-global.com) | [Terms of Service](https://api.ihub-global.com/terms.html) | [Privacy Policy](https://api.ihub-global.com/privacy.html) | [Support](mailto:support@ihub-global.com)

iHub Phoenix is the proprietary native HTTP server and API gateway that powers the iHub developer platform. It serves the full multimodal AI stack — text, vision, image, voice, video and music — through one unified gateway, with a zero third-party inference stack. The developer API, dashboard and documentation run on the dedicated `api.ihub-global.com` subdomain, fully separated from the consumer iHub application.

## Overview

iHub Phoenix exposes a production-grade REST API that lets developers integrate iHub AI services into their own applications. Create unlimited API keys, track credits and usage, generate media, and process payments — all through one authenticated gateway.

### Feature Highlights

- Native AI engine stack: no third-party inference providers for text, vision, image, voice, video or music
- Unlimited API keys per developer account
- Real-time cross-platform user management
- 80 AI models across 6 commercial tiers
- Stripe-powered checkout for subscriptions and top-ups
- Role-based access for admin and super-admin operations
- Fully isolated developer subdomain with independent security rules

### Base URLs

| Environment | URL |
|-------------|-----|
| Production Developer API | `https://api.ihub-global.com` |
| Local Development | `http://localhost:5000` |

## Quick Start

### 1. Register a Developer Account

```bash
curl -X POST https://api.ihub-global.com/api/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "developer@mycompany.com",
    "password": "SecurePass123!"
  }'
```

A new account starts on the free Titanium tier with 500 complimentary credits.

### 2. Log In and Get Your API Key

```bash
curl -X POST https://api.ihub-global.com/api/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "developer@mycompany.com",
    "password": "SecurePass123!"
  }'
```

```bash
curl -X POST https://api.ihub-global.com/v1/api/create-key \
  -H "Authorization: Bearer <your-login-token>"
```

### 3. Make Your First AI Call

```bash
curl -X POST https://api.ihub-global.com/v1/api/ai/text-generation \
  -H "Authorization: Bearer ihup_<your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Write a short ad for liquid soap"}'
```

## Authentication

Every request except `register`, `login`, `health` and the Stripe webhook must include an API key:

```
Authorization: Bearer ihup_<your-api-key>
```

Keys start with the `ihup_` prefix. Revoke a compromised key at any time:

```bash
curl -X DELETE https://api.ihub-global.com/v1/api/revoke-key/<key_id> \
  -H "Authorization: Bearer <your-login-token>"
```

## API Endpoints

### Auth and Account

| Method | Endpoint | Description |
|--------|----------|-------------|
| POST | `/api/register` | Create a developer account |
| POST | `/api/login` | Log in and receive a session token |
| GET | `/v1/api/me` | Current account profile |
| POST | `/v1/api/forgot-password` | Request a password reset |
| POST | `/v1/api/reset-password` | Set a new password |
| POST | `/v1/api/change-password` | Change the current password |

### API Keys and Credits

| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/v1/api/my-keys` | List all API keys |
| POST | `/v1/api/create-key` | Create a new API key |
| DELETE | `/v1/api/revoke-key/{key_id}` | Revoke an API key |
| GET | `/v1/api/my-credits` | Current credit balance |
| GET | `/v1/api/my-plan` | Current subscription tier |
| GET | `/v1/api/my-usage` | Usage history |
| GET | `/api/models-and-tiers` | Available models and tier limits |

### AI Generation

| Method | Endpoint | Description |
|--------|----------|-------------|
| POST | `/v1/api/ipal/chat` | Conversational chat with iPAL |
| POST | `/v1/api/ai/text-generation` | General text generation |
| POST | `/v1/api/ai/coding-assistant` | Code generation, review and fixes |
| POST | `/v1/api/ai/translation` | Translate between languages |
| POST | `/v1/api/ai/document-summarizer` | Summarize documents |
| POST | `/v1/api/ai/grammar-checker` | Grammar and tone check |
| POST | `/v1/api/ai/resume-builder` | Build a professional resume |
| POST | `/v1/api/ai/quiz-generator` | Generate quizzes with answers |
| POST | `/v1/api/ai/social-caption` | Social media captions |
| POST | `/v1/api/ai/lyrics-songwriter` | Song lyrics generation |
| POST | `/v1/api/ai/ad-creator` | Ad creative generation |
| POST | `/v1/api/ai/ad-optimizer` | Ad copy optimization |
| POST | `/v1/api/ai/image-generation` | Generate images from prompts |
| POST | `/v1/api/ai/image-editor` | Edit images |
| POST | `/v1/api/ai/image-upscaler` | Upscale and enhance images |
| POST | `/v1/api/ai/background-eraser` | Remove image backgrounds |
| POST | `/v1/api/ai/style-transfer` | Apply artistic styles |
| POST | `/v1/api/ai/voice-cloning` | Voice cloning (authorized use only) |
| POST | `/v1/api/ai/voice-chat` | Voice conversational AI |
| POST | `/v1/api/ai/text-to-speech` | Read text aloud |
| POST | `/v1/api/ai/speech-to-text` | Transcribe speech |
| POST | `/v1/api/ai/music-generator` | Generate songs and beats |
| POST | `/v1/api/video-generation` | Generate video from prompts |
| POST | `/v1/api/ai/video-editing` | AI-assisted video editing |
| POST | `/v1/api/ai/video-fx` | Video effects and filters |

### Billing

| Method | Endpoint | Description |
|--------|----------|-------------|
| POST | `/v1/api/create-checkout` | Create a Stripe checkout session |
| POST | `/api/checkout/create-payment-intent` | Create a payment intent |
| GET | `/api/checkout/config` | Stripe publishable configuration |
| POST | `/v1/api/webhook/stripe` | Stripe webhook receiver |
| GET | `/v1/api/stripe-status` | Stripe configuration status |

### Health and Status

| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/v1/api/health` | Gateway health |
| GET | `/api/vision/status` | Native vision engine status |
| GET | `/api/tts/health` | Native TTS engine status |
| GET | `/api/audio/health` | Audio engine status |

### Admin (restricted)

| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | `/v1/api/admin/users` | List platform users |
| GET | `/v1/api/admin/dashboard` | Platform dashboard metrics |
| GET | `/v1/api/admin/stats` | Usage statistics |
| POST | `/v1/api/admin/upgrade-user` | Upgrade a user tier |
| POST | `/v1/api/admin/delete-user` | Delete a user |
| POST | `/v1/api/admin/restore-user` | Restore a deleted user |
| GET | `/v1/api/admin/ai-insights` | AI analytics insights |

## Code Examples

### Python

```python
import requests

API_URL = "https://api.ihub-global.com"
API_KEY = "ihup_<your-api-key>"

headers = {
    "Authorization": "Bearer " + API_KEY,
    "Content-Type": "application/json",
}

response = requests.post(
    API_URL + "/v1/api/ai/text-generation",
    headers=headers,
    json={"prompt": "Explain quantum computing in one paragraph"},
)

print(response.json())
```

### JavaScript

```javascript
const API_URL = "https://api.ihub-global.com";
const API_KEY = "ihup_<your-api-key>";

const response = await fetch(`${API_URL}/v1/api/ai/text-generation`, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ prompt: "Explain quantum computing in one paragraph" }),
});

const data = await response.json();
console.log(data);
```

## Error Handling

All errors return JSON with an `error` field and an appropriate HTTP status code.

| Status | Meaning |
|--------|---------|
| 400 | Invalid request body or missing required fields |
| 401 | Missing or invalid API key |
| 403 | Key lacks permission for the requested tier or feature |
| 404 | Endpoint not found |
| 409 | Resource conflict, such as an already-registered email |
| 429 | Daily or monthly quota exhausted |
| 500 | Server error |

## Rate Limits and Tiers

| Tier | Name | Price | Monthly Requests | Daily Requests | Models |
|------|------|-------|------------------|----------------|--------|
| Titanium | Developer Sandbox | $0 | 5,000 | 200 | 3 |
| Bronze | Starter Cloud Production | $29 | 50,000 | 2,000 | 12 |
| Silver | Professional Cloud Workloads | $79 | 200,000 | 7,000 | 25 |
| Gold | Pro Self-Host Access | $199 | 1,000,000 | Unlimited | 40 |
| Platinum | Enterprise Self-Host | $499 | 5,000,000 | Unlimited | 72 |
| Diamond | Custom Enterprise Contract | Custom | Unlimited | Unlimited | 80 |

Titanium requires no credit card. All paid tiers unlock progressive model access; Diamond unlocks all 80 models, including the eight exclusive commercial engines (Enterprise Reasoning, Agent Orchestrator, Photorealistic Pro, Cinematic 4K, Studio Voice Pro, Commercial Stem, Studio Render and 3D Asset Generator).

## SDKs and Libraries

- `ihub-phoenix` — this package: the native server CLI and gateway launcher
- Native mobile bindings for Android and iOS clients
- SDK generator for producing typed client libraries in multiple languages

## Deployment

The `ihub-phoenix` command runs the master core gateway from your iHub Aether workspace:

```bash
ihub-phoenix --host 0.0.0.0 --port 5000
ihub-phoenix --version
ihub-phoenix install-service
ihub-phoenix refresh-models
```

The CLI requires the master core workspace (`app.py`) as the working directory. The server binds to port 5000 by default and runs the full enterprise gateway, including authentication, billing, AI routing and the native model stack.

## FAQ

**Is there a free tier?** Yes. The Titanium tier provides 5,000 complimentary API calls per month with no credit card required.

**Do API credits expire?** Monthly quota resets each billing cycle. Paid top-up credits remain on the account until used.

**Is any third-party AI used?** No. All inference runs on the native iHub Aether model stack; the only external integration is Stripe for payment processing.

**How do I get a higher tier?** Log in to the developer dashboard, open Billing, select Upgrade Plan and complete checkout. New limits apply to your keys within 60 seconds.

**Can I revoke a leaked key?** Yes. Call `DELETE /v1/api/revoke-key/<key_id>` or revoke it from the dashboard immediately.

## Legal

iHub Phoenix is proprietary software owned by iHub Intelligence Limited. Unauthorized copying, redistribution or reverse engineering is prohibited.

Copyright (c) 2026 iHub Intelligence Limited. All rights reserved.
