Skip to content

The Claude2OpenAI is a python server that does on the fly translation between Claude & OpenAI (requests/responses) with minimal configuration

License

Notifications You must be signed in to change notification settings

wolverine2k/claude2openai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Claude2OpenAI APIs to OpenAI API endpoints on the fly router

The Claude2OpenAI is a python server that has the following features:

  1. Ability to intercepts the calls from Claude cli in Claude API format.
  2. Convert those calls to OpenAI format.
  3. Route the converted calls to an OpenAI compatible server.
  4. Get the response from the OpenAI compatible server.
  5. Convert the Open AI response to Claude API format.
  6. Send the response back to the Claude cli.

In the given config.toml file add only the following 2 values and launch the python server. Start using claude like you normally would and voila, everything just works!

  • Open AI Base URL
  • Open AI Key

Add any other necessary parameters to the configuration file.

Usage

See docs/USAGE.md for setup, configuration, and request/response details.

Claude Code Settings needed for Claude to work with Claude2OpenAI server

Modify your ~/.claude/settings.json to the following.

{
  "env": {
    "ANTHROPIC_API_KEY": "non-empty-string",
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:8080/v1",
    "CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
    "CLAUDE_CODE_ENABLE_TELEMETRY": "0"
  },
  "autoUpdatesChannel": "latest",
  "api_base_url": "http://127.0.0.1:8080/v1",
  "api_key": "any-non-empty-string",
  "apiBaseUrl": "http://127.0.0.1:8080/v1",
  "apiKey": "any-non-empty-string"
}

Export following environment variables from your .basrc/.zshrc shell as needed.

export DISABLE_TELEMETRY="true"
export DISABLE_COST_WARNINGS="true"
export API_TIMEOUT_MS="600000"
unset CLAUDE_CODE_USE_BEDROCK

Raise an issue in github as needed. Feel free to contribute. Source code released under (Apache license 2.0)[https://choosealicense.com/licenses/apache-2.0/].

Apache License in Brief

(c) 2026 Naresh Mehta

About

The Claude2OpenAI is a python server that does on the fly translation between Claude & OpenAI (requests/responses) with minimal configuration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages