Aerostack
settings

OpenAI Chat Proxy Function — Deploy to Cloudflare Workers

DevOps

A zero-config proxy for OpenAI /v1/chat/completions with streaming passthrough and CORS support. Replace the API key placeholder and deploy instantly — free public URL included.

aerostack @aerostack verified
Updated Mar 6, 2025
GitHub

Edge function OpenAI Chat Proxy A zero-config proxy for OpenAI /v1/chat/completions with streaming passthrough and CORS support. Replace the API key placeholder and deploy instantly — free public URL included.. Deployed on Cloudflare Workers — zero cold starts, globally distributed. Mount it via your Aerostack workspace to call it from any AI agent.

terminal — aerostack cli
$ npx aerostack add aerostack/openai-chat-proxy
smart_toy

Use with AI Assistants

MCP

Connect Claude, Cursor, or any MCP-compatible client — then call this function by slug

① Add MCP Server

Add this once — access all Aerostack functions from your AI tool.

claude_desktop_config.json
{
  "mcpServers": {
    "aerostack": {
      "url": "https://mcp.aerostack.dev",
      "type": "http"
    }
  }
}

② Call this function

Ask your AI to use the call_function tool with this slug:

call_function
call_function({
  slug: "openai-chat-proxy",
  args: {}
})

OpenAI Chat Proxy

Deploy this function to get a free public URL that proxies OpenAI's chat completions API.

Usage

curl https://{your-project}.aerostack.dev/custom/openai-chat-proxy \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-4","messages":[{"role":"user","content":"Hello!"}]}'

Setup

  1. Open the function editor and replace sk-your-key-here with your OpenAI API key
  2. Click Deploy to Edge
  3. Use the URL above — it's live immediately, no auth required

Connect to a Gateway

For auth, billing, rate limiting, and analytics → connect this function to an AI Gateway.

Metadata

upgrade Version 1.0.0
gavel License MIT
language Language typescript
cloud Provider cloudflare-worker

Tags

openai proxy chat streaming cors
deployed_code

Build and publish your own functions

Write a TypeScript function, deploy it to the edge, and share it with thousands of developers — in minutes.

More Devops Functions

Browse Devops Functions →

Frequently asked questions

What does the OpenAI Chat Proxy function do? +

OpenAI Chat Proxy is a serverless edge function for devops automation written in cloudflare-worker. Deploy it to Cloudflare Workers via your Aerostack workspace.

How do I deploy the OpenAI Chat Proxy function? +

Install the Aerostack CLI and run: ```bash aerostack deploy function @aerostack/openai-chat-proxy ``` It will be live on Cloudflare Workers in seconds.

What runtime does OpenAI Chat Proxy use? +

OpenAI Chat Proxy runs on cloudflare-worker on the Cloudflare Workers edge runtime — zero cold starts, globally distributed.

Can I customise the OpenAI Chat Proxy function? +

Yes. Fork the function from your Aerostack dashboard, modify the source, and redeploy. All changes are version-controlled.