A minimal Bun application that serves an OpenAI-compatible API server, converting input messages to Traditional Chinese using OpenCC.
sh install.shor
bun installbun run startThe server will start at http://localhost:11434/v1
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
}
}curl -X POST http://localhost:11434/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "opencc-transformation",
"messages": [{"role": "user", "content": "你好世界"}]
}'