GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ewgsta/subtranslation-api: AI-powered ASS SRT VTT subtitle translation tool.

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
.vscode
.vscode
 
 
api
api
 
 
src
src
 
 
.dockerignore
.dockerignore
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
Caddyfile
Caddyfile
 
 
Dockerfile
Dockerfile
 
 
README.md
README.md
 
 
docker-compose.yml
docker-compose.yml
 
 
index.html
index.html
 
 
index.js
index.js
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
vercel.json
vercel.json
 
 

Repository files navigation

AI Translation API

SRT and VTT subtitle files translator to Turkish.

Installation

npm install

Create a .env file:

OPENROUTER_API_KEY=your_openrouter_key
API_KEY=your_secret_key
PORT=3000

Running

npm start

API Usage

Endpoint

POST /api/translate

Headers

Header Required Description
x-api-key Yes API_KEY value from .env
Content-Type Yes multipart/form-data

Body

Field Type Description
file File .srt or .vtt file

Example Request (cURL)

curl -X POST http://localhost:3000/api/translate \
  -H "x-api-key: your_secret_key" \
  -F "[email protected]"

Example Request (JavaScript)

const formData = new FormData();
formData.append('file', file);
const response = await fetch('http://localhost:3000/api/translate', {
  method: 'POST',
  headers: {
    'x-api-key': 'your_secret_key'
  },
  body: formData
});
const blob = await response.blob();

Successful Response

  • Status: 200
  • Content-Type: text/plain
  • Content-Disposition: attachment; filename="original_filename.vtt"
  • Body: Translated subtitle content

Error Responses

{
  "error": {
    "code": 1001,
    "message": "File not uploaded"
  }
}
Code Description
1001 File not uploaded
1002 Unsupported format
1003 File could not be read
1004 File size too large (max 5MB)
2001 API key missing
2002 API key invalid
3001 OpenRouter API error
3002 Model did not respond
3004 Rate limit exceeded

Deploy to Vercel

  1. Push to GitHub
  2. Import on Vercel
  3. Add environment variables:
    • OPENROUTER_API_KEY
    • API_KEY
  4. Deploy
npm i -g vercel
vercel

Limits

  • Max file size: 5MB
  • Supported formats: .srt, .vtt

Running with Docker and Local Domain

You can run the project in an isolated manner with Docker and test it using the aiceviri-api.local domain name.

  1. Create your .env file:
cp .env.example .env

Add the required API keys. You can allow requests from external sources by adding the CORS_ORIGINS variable:

CORS_ORIGINS=http://localhost:3000,https://aiceviri-api.local
  1. Add the domain to your computer's hosts file:

    • Linux/Mac: Open /etc/hosts with sudo nano /etc/hosts.
    • Windows: Open C:\Windows\System32\drivers\etc\hosts as administrator.

    Add this line:

    127.0.0.1 aiceviri-api.local
    
  2. Start with Docker Compose:

docker-compose up -d

Your API will now be available at https://aiceviri-api.local/api/translate. Caddy will automatically create its own SSL certificate (tls internal) for local development. If your browser shows a security warning, you can proceed from the advanced tab.

About

AI-powered ASS SRT VTT subtitle translation tool.

ewgsta.github.io/subtranslation-api/

Resources

Readme
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.