AI & ML interests

None defined yet.

Organization Card

🌟 AI Studio Pro & Multi-Modal Proxy Bridge

Soushiyans Edition (v2.2.2 Bulletproof Architecture)

FastAPI HuggingFace OpenAI Compatible Python Version License: MIT

A unified, high-performance, and resilient gateway connecting cutting-edge LLMs, ultra-fast image generators, and multi-modal models directly to any OpenAI-compatible client, third-party framework, or web application.

Explore Documentation • Key Features • Installation • Architecture • About the Author


📖 Executive Summary

AI Studio Pro (Soushiyans Edition) was designed to solve the critical challenges developers face when integrating multi-provider AI APIs: endpoint deprecation (e.g., Hugging Face Serverless 410 errors), routing 404s, provider rate-limiting, and network-level DPI/DNS blockades.

Built on an asynchronous FastAPI backend with automated Multi-Tier Failover (Tier-1 HF Router + Tier-2 Shield Fallback) and an embedded Socket-Level Smart DNS Resolver, this suite guarantees 99.9% uptime and full compatibility with OpenAI API specs (/v1/chat/completions, /v1/models, /v1/images/generate).


✨ Key Features

1. 🔄 Universal OpenAI Compatibility

  • Drop-in replacement for OpenAI API endpoints.
  • Seamless connection with desktop & web clients: Chatbox, NextChat (ChatGPT-Next-Web), LobeChat, LibreChat, Cursor, and VS Code Continue.
  • Support for token streams, structured outputs, and role-based completions (system, user, assistant).

2. 🛡️ Dual-Tier Zero-Downtime Engine

  • Primary Tier (HF Inference Router): Routes requests directly to official inference nodes for state-of-the-art models.
  • Shield Tier (Instant Fallback): If Hugging Face encounters congestion, 404 routing shifts, or 410 deprecation status, the engine automatically falls back to secondary high-speed endpoints with zero user interruption.

3. 🧠 Top-Tier Model Ensemble

  • Chat & Reasoning:
    • deepseek-ai/DeepSeek-R1-Distill-Qwen-32B (High reasoning speed and mathematics/coding depth)
    • Qwen/Qwen2.5-72B-Instruct (Enterprise grade multilingual & technical prowess)
    • meta-llama/Llama-3.3-70B-Instruct (Flagship open-weights model)
    • deepseek-ai/DeepSeek-V3 (State-of-the-art Mixture of Experts)
  • Image Generation:
    • black-forest-labs/FLUX.1-schnell (Sub-second photorealistic rendering)
    • stabilityai/stable-diffusion-xl-base-1.0 (Native high-resolution details)
    • runwayml/stable-diffusion-v1-5 (Fast, lightweight iterations)
  • Text-to-Video:
    • damo-vilab/text-to-video-ms-1.7b (Direct video frame rendering)

4. ⚡ Socket-Level Anti-Block DNS Patch

  • Overcomes DNS pollution, ISP-level handshake degradation, and SSL negotiation timeouts by patching Python's native socket.getaddrinfo to resolve authoritative Anycast IPs.

5. 🎨 Built-in Glassmorphic Studio Web UI

  • Accessible out of the box at /web.
  • Features real-time prompt enhancement, temperature modulation, model switching, image gallery, and responsive dark-mode styling.

🏗️ Multi-Tier Fault-Tolerant Architecture


                  ┌──────────────────────────────────────────────┐
                  │    OpenAI-Compatible Clients / Web Studio    │
                  │   (Chatbox / LobeChat / Python SDK / Web)    │
                  └──────────────────────┬───────────────────────┘
                                         │ HTTP Request
                                         ▼
                  ┌──────────────────────────────────────────────┐
                  │   Soushiyans AI Proxy Engine (Port: 8090)    │
                  │   - Custom DNS Resolution & Anti-Block Hook  │
                  │   - Async HTTPX Connection Pool              │
                  │   - Dynamic Model Payload Formatting         │
                  └──────────────┬───────────────────────────────┘
                                 │
                 ┌───────────────┴───────────────┐
                 │                               │
                 ▼ [Primary Tier]                ▼ [Shield Fallback Tier]
     ┌───────────────────────┐       ┌───────────────────────┐
     │   HF Router Gateway   │       │ Ultra-Fast Fallback   │
     │  (router.hf.co/v1)    │       │     Shield Engine     │
     └───────────┬───────────┘       └───────────┬───────────┘
                 │ (Status 200 OK)               │ (Auto-Switched on Fail)
                 └───────────────┬───────────────┘
                                 ▼
                  ┌──────────────────────────────┐
                  │   Normalized JSON Response   │
                  │ (Standard OpenAI Schema / B64)│
                  └──────────────────────────────┘

🚀 Installation and Quickstart

Prerequisites

  • Python 3.10 or higher
  • Git

1. Clone the Repository

git clone https://huggingface.co/organizations/YOUR_ORG/ai-studio-pro.git
cd ai-studio-pro

2. Set Up Virtual Environment & Dependencies

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux / macOS:
source venv/bin/activate

# Install requirements
pip install fastapi uvicorn httpx pydantic

3. Set Your Access Token (Optional)

If you wish to provide your own Hugging Face token:

# Windows (CMD):
set HF_TOKEN=hf_your_token_here

# Windows (PowerShell):
$env:HF_TOKEN="hf_your_token_here"

# Linux / macOS:
export HF_TOKEN="hf_your_token_here"

4. Run the Server

python main.py

Once launched, access the endpoints:

  • 🌐 Web Studio UI: http://127.0.0.1:8090/web
  • 📡 API Base URL: http://127.0.0.1:8090/v1
  • 📚 Interactive Swagger Docs: http://127.0.0.1:8090/docs

📡 API Endpoints and Usage

1. Chat Completion (POST /v1/chat/completions)

Request

curl -X POST http://127.0.0.1:8090/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Qwen/Qwen2.5-72B-Instruct",
    "messages": [
      {"role": "system", "content": "You are a professional coding assistant."},
      {"role": "user", "content": "Write a Python script to verify prime numbers."}
    ],
    "temperature": 0.7,
    "max_tokens": 1024
  }'

Response

{
  "id": "chatcmpl-qwen-72b",
  "object": "chat.completion",
  "model": "Qwen/Qwen2.5-72B-Instruct",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Here is the optimized Python function to check for prime numbers..."
      },
      "finish_reason": "stop"
    }
  ]
}

2. Image Generation (POST /v1/images/generate)

Request

curl -X POST http://127.0.0.1:8090/v1/images/generate \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Futuristic cyberpunk neon city with flying cars, 8k resolution, octane render",
    "model": "black-forest-labs/FLUX.1-schnell"
  }'

Response

{
  "created": true,
  "model": "black-forest-labs/FLUX.1-schnell",
  "image_base64": "data:image/jpeg;base64,...",
  "data": [
    {
      "url": "data:image/jpeg;base64,..."
    }
  ]
}

3. Prompt Enhancement (POST /v1/prompt/enhance)

Request

curl -X POST http://127.0.0.1:8090/v1/prompt/enhance \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a cute robotic cat in space"
  }'

⚙️ Integrating with Client Applications

Chatbox Configuration

  1. Open Chatbox Settings -> Model Provider.
  2. Select Custom / OpenAI API.
  3. Set API Host to: http://127.0.0.1:8090 (or http://127.0.0.1:8090/v1).
  4. Set API Key to any placeholder (e.g. sk-soushiyans-local).
  5. Choose model: Qwen/Qwen2.5-72B-Instruct or deepseek-ai/DeepSeek-R1-Distill-Qwen-32B.

👨‍💻 Author & Credits


📄 License

This project is licensed under the MIT License — see the LICENSE file for details.

models 0

None public yet

datasets 0

None public yet