Sciratest / README.md
Samfy001's picture
Rename README_HUGGINGFACE.md to README.md
2d19977 verified
|
Raw
History Blame
3.78 kB
metadata
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

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

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

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

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

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.