cyhhao/chatjimmy-proxy

OpenAI-compatible API proxy for ChatJimmy (Llama 3.1 8B), deployed on Vercel Edge Runtime

★ 0Forks 0JavaScriptGitHub ↗Compare

README

chatjimmy-proxy

An OpenAI-compatible API proxy for ChatJimmy, deployed on Vercel Edge Runtime.

Wraps ChatJimmy's Llama 3.1 8B model behind a standard /v1/chat/completions endpoint, so you can use it with any OpenAI-compatible client (e.g. Continue, Open WebUI, curl, Python openai SDK, etc.).

Features

  • OpenAI-compatible — drop-in /v1/chat/completions endpoint
  • Streaming & non-streaming — supports both SSE stream and regular JSON response
  • Zero dependencies — single Edge Function, no node_modules
  • CORS enabled — works from browser-based clients
  • One-click deploy — runs on Vercel free tier

Quick Start

Use the public instance

Base URL: https://chatjimmy-proxy.vercel.app/v1
Model:    llama3.1-8B
API Key:  not required (pass any value if the client requires one)

Deploy your own

Deploy with Vercel

Or manually:

git clone https://github.com/cyhhao/chatjimmy-proxy.git
cd chatjimmy-proxy
npx vercel --prod

Usage

curl

# Non-streaming
curl https://chatjimmy-proxy.vercel.app/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama3.1-8B",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

# Streaming
curl https://chatjimmy-proxy.vercel.app/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama3.1-8B",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": true
  }'

Python (openai SDK)

from openai import OpenAI

client = OpenAI(
    base_url="https://chatjimmy-proxy.vercel.app/v1",
    api_key="any",  # not validated, but required by the SDK
)

response = client.chat.completions.create(
    model="llama3.1-8B",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

Project Structure

chatjimmy-proxy/
├── api/v1/chat/
│   └── completions.js   # Edge Function handler
├── vercel.json           # URL rewrite rules
├── package.json
└── LICENSE

How It Works

Client ──POST /v1/chat/completions──▶ Vercel Edge ──▶ chatjimmy.ai/api/chat
                                        │
                                  Translates between
                                  OpenAI format and
                                  ChatJimmy format
  1. Receives OpenAI-format requests
  2. Translates and forwards to ChatJimmy API (model hardcoded to llama3.1-8B)
  3. Strips internal metadata (<|stats|> blocks) from the response
  4. Returns in OpenAI-compatible format (supports both streaming SSE and JSON)

Limitations

  • Model is fixed to llama3.1-8B — the model parameter in requests is accepted but ignored
  • usage field returns zeros (upstream doesn't provide token counts)
  • Availability depends on ChatJimmy's upstream service

License

MIT

Contributors

cyhhao

Issues