Cloudflare Worker proxy that converts API calls from Gemini and OpenAI models to Claude Code format. Enables low-cost, zero-configuration access to Claude Code with One-Balance integration. Supports streaming and non-streaming responses, tool calls, and easy deployment.
git clone https://github.com/glidea/claude-worker-proxy.gitCloudflare Worker proxy that converts API calls from Gemini and OpenAI models to Claude Code format. Enables low-cost, zero-configuration access to Claude Code with One-Balance integration. Supports streaming and non-streaming responses, tool calls, and easy deployment.
[{"step":"Prepare your API call. Write your prompt in the format expected by OpenAI or Gemini models, including any required tools or parameters. For example: 'Analyze customer feedback data in [DATASET] and classify sentiment using [MODEL]. Use [TOOLS] for execution.'","tip":"Use the Claude Code documentation to ensure your prompt includes all necessary components like tools, streaming flags, and message structure."},{"step":"Deploy the Cloudflare Worker proxy. Clone the proxy repository from [GITHUB_REPO] and run `npm install` followed by `wrangler deploy --name claude-worker-proxy`. Configure your One-Balance API key in the worker's environment variables.","tip":"Use the Wrangler CLI for deployment. Ensure your Cloudflare account has Workers enabled and sufficient quota for your expected usage volume."},{"step":"Convert your API call. Send your OpenAI/Gemini-style request to the deployed worker endpoint. The proxy will automatically convert the request format to match Claude Code's requirements. Use curl for testing: `curl -X POST https://claude-worker-proxy.your-subdomain.workers.dev -H 'Content-Type: application/json' -d '{\"messages\": [...]}'`.","tip":"Enable streaming by setting 'stream': true in your request body. This reduces latency for large responses."},{"step":"Process the response. The proxy will return a Claude Code-compatible response with tool calls, text chunks, or final output. Parse the response to extract results or handle tool executions as needed.","tip":"For tool calls, implement a handler to execute the code in a sandboxed environment (e.g., using Docker or a cloud function) and return the results to the proxy."},{"step":"Monitor usage and costs. Check your One-Balance dashboard for token usage, costs, and performance metrics. Adjust your deployment settings (e.g., concurrency limits) based on observed traffic patterns.","tip":"Set up Cloudflare Workers Analytics to track request volumes, latency, and errors. Use this data to optimize your proxy configuration."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/glidea/claude-worker-proxyCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Use the Claude Worker Proxy to convert [OPENAI_API_CALL] or [GEMINI_API_CALL] into a Claude Code-compatible format. Deploy the proxy to Cloudflare Workers using [DEPLOYMENT_COMMAND]. Ensure the proxy is configured with your One-Balance API key. Test the converted call with [TEST_INPUT] and verify the output matches expected Claude Code behavior.
```json
{
"converted_request": {
"model": "claude-3-5-sonnet-20241022",
"messages": [
{
"role": "user",
"content": "Write a Python script to analyze a CSV file with columns 'date', 'revenue', and 'expenses'. Calculate monthly profit and generate a line chart using matplotlib."
}
],
"tools": [
{
"name": "code_interpreter",
"description": "A tool that executes code in a sandboxed environment and returns the output",
"input_schema": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "The Python code to execute"
}
},
"required": ["code"]
}
}
],
"stream": true
},
"proxy_response": {
"status": "success",
"response_id": "msg_1234567890",
"content": [
{
"type": "text",
"text": "Here's a Python script to analyze your CSV file and generate the requested visualization..."
},
{
"type": "tool_call",
"name": "code_interpreter",
"arguments": {
"code": "import pandas as pd\nimport matplotlib.pyplot as plt\n\ndf = pd.read_csv('data.csv')\ndf['profit'] = df['revenue'] - df['expenses']\ndf['date'] = pd.to_datetime(df['date'])\nmonthly_profit = df.groupby(df['date'].dt.to_period('M'))['profit'].sum()\n\nplt.figure(figsize=(10, 6))\nmonthly_profit.plot(kind='line', marker='o')\nplt.title('Monthly Profit')\nplt.xlabel('Date')\nplt.ylabel('Profit ($)')\nplt.grid(True)\nplt.savefig('monthly_profit.png')\nplt.close()"
}
}
],
"usage": {
"input_tokens": 125,
"output_tokens": 450,
"total_tokens": 575
}
}
}
```
The proxy successfully converted the OpenAI-style API call into a Claude Code-compatible request, deployed the Cloudflare Worker, and returned a streaming response with tool calls. The generated script was executed in a sandboxed environment, producing the expected line chart saved as 'monthly_profit.png'. The total cost was $0.0023, demonstrating the low-cost advantage of the One-Balance integration.Smart ring for digital payments
Protect and enhance web performance with DDoS protection, firewalls, and content delivery.
AI assistant built for thoughtful, nuanced conversation
IronCalc is a spreadsheet engine and ecosystem
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan