Skip to content

g0v/opencc-transformation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenCC Transformation Server

A minimal Bun application that serves an OpenAI-compatible API server, converting input messages to Traditional Chinese using OpenCC.

Installation

sh install.sh

or

bun install

Usage

bun run start

The server will start at http://localhost:11434/v1

API

POST /v1/chat/completions

Converts the input message to Traditional Chinese.

Request:

{
  "model": "opencc-transformation",
  "messages": [
    {
      "role": "user",
      "content": "你好世界"
    }
  ]
}

Response:

{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1234567890,
  "model": "opencc-transformation",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "你好世界"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 4,
    "completion_tokens": 4,
    "total_tokens": 8
  }
}

Example

curl -X POST http://localhost:11434/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "opencc-transformation",
    "messages": [{"role": "user", "content": "你好世界"}]
  }'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •