Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/missuo/claude2openai
Convert the Claude API to OpenAI compatible API.
https://github.com/missuo/claude2openai
claude-3 claude-api openai-api
Last synced: about 2 months ago
JSON representation
Convert the Claude API to OpenAI compatible API.
- Host: GitHub
- URL: https://github.com/missuo/claude2openai
- Owner: missuo
- License: mit
- Created: 2024-03-17T20:13:46.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-24T10:40:20.000Z (about 2 months ago)
- Last Synced: 2024-07-31T08:37:58.198Z (about 2 months ago)
- Topics: claude-3, claude-api, openai-api
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 67
- Watchers: 5
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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-haiku-20240307**.## Request Example
```bash
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-haiku-20240307",
"messages": [
{
"role": "system",
"content": "翻译为中文!"
},
{
"role": "user",
"content": "Hello!"
}
],
"stream": true
}'
```## Usage
### Docker```bash
docker run -d --restart always -p 6600:6600 ghcr.io/missuo/claude2openai:latest
``````bash
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.
```diff
+version: "3.9"
``````bash
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](https://github.com/missuo/claude2openai/releases).
```bash
chmod +x claude2openai
./claude2openai
```## License
[MIT](https://github.com/missuo/claude2openai/blob/main/LICENSE)