Home

Awesome

<div align="center">

📦 Chat Nio Blob Service

🤯 File Service for Chat Nio

Deploy to Vercel

Deploy on Zeabur

</div>

Features

Supported File Types

Deploy by Docker

Image: programzmh/chatnio-blob-service

docker run -p 8000:8000 programzmh/chatnio-blob-service

# with environment variables
# docker run -p 8000:8000 -e AZURE_SPEECH_KEY="..." -e AZURE_SPEECH_REGION="..." programzmh/chatnio-blob-service


# if you are using `local` storage type, you need to mount volume (/static) to the host
# docker run -p 8000:8000 -v /path/to/static:/static programzmh/chatnio-blob-service

Deploy to Render.com

Deploy to Render

Select Web Service and Docker Image, then input the image programzmh/chatnio-blob-service and click Create Web Service.

⭐ Render.com Includes Free 750 Hours of Usage per Month

Deploy by Source Code

The service will be running on http://localhost:8000

Run

git clone --branch=main https://github.com/Deeptrain-Community/chatnio-blob-service
cd chatnio-blob-service

pip install -r requirements.txt
uvicorn main:app

# enable hot reload
# uvicorn main:app --reload

API

POST /upload Upload a file

{
    "file": "[file]",
    "enable_ocr": false,
    "enable_vision": true,
    "save_all": false
}
ParameterTypeDescription
file*FileFile to Upload
enable_ocrBooleanEnable OCR (Default: false) <br/>*should configure OCR config
enable_visionBooleanEnable Vision (Default: true) <br/>*skip if enable_ocr is true
save_allBooleanSave All Images (Default: false) <br/>*store all types of files without handling

Response

{
  "status": true,
  "type": "pdf",
  "content": "...",
  "error": ""
}
ParameterTypeDescription
statusBooleanRequest Status
typeStringFile Type
contentStringFile Data
errorStringError Message

Environment Variables

1 🎨 General Config (Optional)

2 🔊 Audio Config (Optional)

3 🖼 Storage Config (Optional)

[!NOTE] Storage Config Apply to Image Files And Save All Option Only.

  1. ✨ No Storage (Default)

    • No Storage Required & No External Dependencies
    • Base64 Encoding/Decoding
    • Do Not Store Anything
    • Support Serverless Deployment Without Storage (e.g. Vercel)
    • No Direct URL Access (Base64 not support models like gpt-4-all)
  2. 📁 Local Storage

    • Require Server Environment (e.g. VPS, Docker)
    • Support Direct URL Access
    • Payless Storage Cost
    • Config:
      • set env STORAGE_TYPE to local (e.g. STORAGE_TYPE=local)
      • set env LOCAL_STORAGE_DOMAIN to your deployment domain (e.g. LOCAL_STORAGE_DOMAIN=http://blob-service.onrender.com)
      • if you are using Docker, you need to mount volume /app/static to the host (e.g. -v /path/to/static:/app/static)
  3. 🚀 AWS S3

    • Payment Storage Cost
    • Support Direct URL Access
    • China Mainland User Friendly
    • Config:
      • set env STORAGE_TYPE to s3 (e.g. STORAGE_TYPE=s3)
      • set env S3_ACCESS_KEY to your AWS Access Key ID
      • set env S3_SECRET_KEY to your AWS Secret Access Key
      • set env S3_BUCKET to your AWS S3 Bucket Name
      • set env S3_REGION to your AWS S3 Region
  4. 🔔 Cloudflare R2

    • Free Storage Quota (10GB Storage & Zero Outbound Cost)
    • Support Direct URL Access
    • Config (S3 Compatible):
      • set env STORAGE_TYPE to s3 (e.g. STORAGE_TYPE=s3)
      • set env S3_ACCESS_KEY to your Cloudflare R2 Access Key ID
      • set env S3_SECRET_KEY to your Cloudflare R2 Secret Access Key
      • set env S3_BUCKET to your Cloudflare R2 Bucket Name
      • set env S3_DOMAIN to your Cloudflare R2 Domain Name (e.g. https://<account-id>.r2.cloudflarestorage.com)
      • set env S3_DIRECT_URL_DOMAIN to your Cloudflare R2 Public URL Access Domain Name (Open Public URL Access, e.g. https://pub-xxx.r2.dev)
  5. 📦 Min IO

    • Self Hosted
    • Reliable & Flexible Storage
    • Config (S3 Compatible):
      • set env STORAGE_TYPE to s3 (e.g. STORAGE_TYPE=s3)
      • set env S3_SIGN_VERSION to s3v4 (e.g. S3_SIGN_VERSION=s3v4)
      • set env S3_ACCESS_KEY to your Min IO Access Key ID
      • set env S3_SECRET_KEY to your Min IO Secret Access Key
      • set env S3_BUCKET to your Min IO Bucket Name
      • set env S3_DOMAIN to your Min IO Domain Name (e.g. https://oss.example.com)
      • [Optional] If you are using CDN, you can set S3_DIRECT_URL_DOMAIN to your Min IO Public URL Access Domain Name (e.g. https://cdn-hk.example.com)
  6. Telegram CDN

    • Free Storage (Rate Limit)
    • Support Direct URL Access (China Mainland User Unfriendly)
    • Limited File Type & Format
    • Config:
      • set env STORAGE_TYPE to tg (e.g. STORAGE_TYPE=tg)

      • set env TG_ENDPOINT to your TG-STATE Endpoint (e.g. TG_ENDPOINT=https://tgstate.vercel.app)

      • [Optional] if you are using password authentication, you can set TG_PASSWORD to your TG-STATE Password

4 🔍 OCR Config (Optional)

[!NOTE] OCR Support is based on 👉 PaddleOCR API (✔ Self Hosted ✔ Open Source)

Common Errors

Development

Tech Stack

License

Apache License 2.0