SuperAPI AI Directory

claude-to-chatgpt

claude-to-chatgpt is an open-source project for converting Anthropic's Claude model API into the OpenAI Chat API format. The core goal of this project is to let developers call the Claude API in the same way as the OpenAI ChatGPT API. It supports streaming responses and is compatible with both the claude-instant-1 and claude-2 models. The project offers two deployment methods: via Cloudflare Workers or Docker. When using Cloudflare Workers, no server of your own is needed, and it supports 100,000 requests per day; if a higher call volume is needed, Docker deployment can be used. When the input model parameter is gpt-3.5-turbo or gpt-3.5-turbo-0613, it is replaced with claude-instant-1; otherwise claude-2 is used. This conversion layer enables GUI clients that originally only support the OpenAI API (such as Chatbox and ChatGPT-Next-Web) to also connect to the Claude models. The project is open-sourced under the MIT license.

Open website

About this tool

Purpose

claude-to-chatgpt is an API conversion layer project whose main purpose is to convert Anthropic's Claude model API into the OpenAI Chat API format. Through this conversion, developers can call the Claude models in the same way as calling the OpenAI ChatGPT API, thereby reusing existing OpenAI API clients, SDKs, or GUI tools.

Main capabilities

  • API format conversion: Converts Claude's Completion API (endpoint /v1/complete) into OpenAI's Chat API (endpoint /v1/chat/completions) format, obtains completion results from the Claude model, and formats them as an OpenAI Chat response.
  • Streaming response support: Supports streaming responses, consistent with the behavior of the OpenAI API.
  • Model compatibility: Supports claude-instant-1 and claude-2 models. When the input model parameter is gpt-3.5-turbo or gpt-3.5-turbo-0613 , it is replaced with claude-instant-1; otherwise claude-2is used.
  • Multiple deployment methods: Supports deployment via Cloudflare Workers or Docker.

Usage

Deploy via Cloudflare Workers

  1. Create a Cloudflare Worker.
  2. Paste the code from cloudflare-worker.js into the "Quick Edit" editor of the Cloudflare Worker.
  3. Save and deploy.
  4. (Optional) Set a custom domain for the Cloudflare Worker.

Cloudflare Workers supports 100,000 requests per day. If the call volume exceeds this limit, Docker deployment can be used.

Deploy via Docker

After deploying with Docker, the API will be available at http://localhost:8000 , and the API endpoint is /v1/chat/completions.

Recommended GUI clients

The project recommends the following GUI software that supports this conversion layer:

  • Bin-Huang/chatbox
  • Yidadaa/ChatGPT-Next-Web

Use cases

  • Wanting to switch to or test Claude models without modifying existing OpenAI API call code.
  • Using third-party GUI clients that only support the OpenAI API (such as Chatbox and ChatGPT-Next-Web) to connect to Claude models.
  • Quickly deploying a Claude-to-OpenAI format conversion service in a serverless environment.

Limitations

  • The conversion only involves adaptation at the API format level and does not change the capabilities and limitations of the Claude models themselves.
  • The free version of Cloudflare Workers is limited to 100,000 requests per day; beyond that, Docker deployment is required.
  • The model mapping rules are fixed:gpt-3.5-turbo or gpt-3.5-turbo-0613 maps to claude-instant-1, and others map to claude-2.
  • The project uses the MIT license.