--- title: Scira AI Reverse API emoji: 🤖 colorFrom: blue colorTo: purple sdk: docker pinned: false license: mit app_port: 7860 --- # Scira AI Reverse API A FastAPI server that provides OpenAI-compatible endpoints for Scira AI with advanced rate limiting bypass features. ## 🚀 Features - ✅ **Full OpenAI Compatibility** - Drop-in replacement for OpenAI API - ✅ **Streaming Support** - Real-time SSE responses - ✅ **Function Calling** - Complete tool calling support - ✅ **Rate Limiting Bypass** - Proxy rotation and header spoofing - ✅ **FastAPI Framework** - High performance async API ## 📡 API Endpoints ### OpenAI-Compatible - `POST /v1/chat/completions` - Chat completions with streaming - `GET /v1/models` - List available models ### Legacy Scira - `POST /api/search` - Direct Scira API compatibility - `GET /health` - Health check - `GET /` - API information ## 🔧 Usage ### Basic Chat ```bash curl -X POST "https://your-space.hf.space/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "scira-5-mini", "messages": [ {"role": "user", "content": "Hello!"} ] }' ``` ### Streaming ```bash curl -X POST "https://your-space.hf.space/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "scira-5-mini", "messages": [ {"role": "user", "content": "Tell me a story"} ], "stream": true }' ``` ### Function Calling ```bash curl -X POST "https://your-space.hf.space/v1/chat/completions" \ -H "Content-Type: application/json" \ -d '{ "model": "scira-5-mini", "messages": [ {"role": "user", "content": "What is the weather?"} ], "tools": [ { "type": "function", "function": { "name": "get_weather", "description": "Get weather for a location", "parameters": { "type": "object", "properties": { "location": {"type": "string"} }, "required": ["location"] } } } ] }' ``` ## 🔑 Configuration The API uses environment variables for configuration. Set these in your Hugging Face Space settings: - `SCIRA_SESSION_TOKEN` - Your Scira session token - `SCIRA_POSTHOG_TOKEN` - Your PostHog token - `PROXY_HOST` - Proxy host (optional) - `PROXY_USERNAME` - Proxy username (optional) - `PROXY_PASSWORD` - Proxy password (optional) ## 🛡️ Rate Limiting Features - **Proxy Rotation** - Residential proxy support - **Header Spoofing** - Randomized User-Agent and browser headers - **IP Spoofing** - X-Forwarded-For randomization - **Request Throttling** - Random delays between requests ## 📊 Supported Parameters All OpenAI parameters are supported: - `model`, `messages`, `max_tokens` - `temperature`, `top_p`, `presence_penalty` - `stream`, `tools`, `tool_choice` - `stop`, `frequency_penalty`, `logit_bias` ## 🔗 Integration ### Python with OpenAI Library ```python import openai openai.api_base = "https://your-space.hf.space/v1" openai.api_key = "dummy" response = openai.ChatCompletion.create( model="scira-5-mini", messages=[{"role": "user", "content": "Hello!"}] ) ``` ### JavaScript ```javascript const response = await fetch('https://your-space.hf.space/v1/chat/completions', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ model: 'scira-5-mini', messages: [{role: 'user', content: 'Hello!'}] }) }); ``` ## ⚠️ Important Notes - This is for educational and research purposes - Configure valid session tokens for proper functionality - Respect Scira AI's terms of service - Rate limiting helps avoid detection but doesn't guarantee it ## 📄 License MIT License - See LICENSE file for details.