Skip to content

Latest commit

 

History

History
71 lines (56 loc) · 1.66 KB

README.md

File metadata and controls

71 lines (56 loc) · 1.66 KB

Claude2OpenAI

Used to convert the Claude API to OpenAI compatible API. Easily use Claude with any OpenAI compatible client.

Compatibility

Currently it is only compatible with the Claude-3 family of models, if you pass in any other model, the default will be to use claude-3-5-haiku-20241022.

Request Example

curl http://127.0.0.1:6600/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-ant-xxxxxxxxxxxxxxxx" \
  -d '{
    "model": "claude-3-5-haiku-20241022",
    "messages": [
      {
        "role": "system",
        "content": "翻译为中文!"
      },
      {
        "role": "user",
        "content": "Hello!"
      }
    ],
    "stream": true
  }'

Usage

Homebrew (MacOS)

Special thanks to Sma1lboy for his contribution.

brew tap owo-network/brew
brew install claude2openai

Docker

docker run -d --restart always -p 6600:6600 ghcr.io/missuo/claude2openai:latest
docker run -d --restart always -p 6600:6600 missuo/claude2openai:latest

Docker Compose

It is recommended that you use docker version 26.0.0 or higher, otherwise you need to specify the version in the compose.yaml file.

+version: "3.9"
mkdir claude2openai && cd claude2openai
wget -O compose.yaml https://raw.githubusercontent.com/missuo/claude2openai/main/compose.yaml
docker compose up -d

Manual

Download the latest release from the release page.

chmod +x claude2openai
./claude2openai

License

MIT