Git Product home page Git Product logo

ai-gateway-openai-wrapper's Introduction

AI Gateway (OpenAI) Wrapper

Provide you OpenAI compatible, cost effective and proxied api endpoints on Cloudflare Worker. Foolproof considered.

Deploy to Cloudflare Workers

Features

  • Expose AI Gateway endpoint to OpenAI compatible APIs. Use proxied api anywhere.
  • Foolproof design. You need to use dummy api key, which cannot be the same with your real OpenAI API key, to access proxied api. This helps you prevent leaking your real key and make sure you never send proxied requests to official endpoint.
  • Cost effective. Use Observe and control to help you control expense and analyze api requests. Never receive surprise bills again!

Getting Started

  1. Create your OpenAI API key on OpenAI Platform. For best foolproof effect, we recommend you do not reuse old one and create fresh new key solely used by this worker.
  2. Create AI Gateway in Cloudflare.
  3. Deploy this worker by Clicking Here.
  4. Add following environment variables to your newly created worker (Encrypting these variables is strongly advised!):
    • AI_GATEWAY_ENDPOINT_URL: Your AI Gateway endpoint url. Should looks like: https://gateway.ai.cloudflare.com/v1/ACCOUNT_TAG/GATEWAY/openai.
    • DUMMY_WRAPPER_KEY: Your API key supplied when you calling the wrapper endpoint. Can be any string. This cannot be the the same with your real OpenAI key. Otherwise your request will be rejected by worker for foolproof reason.
    • REAL_OPENAI_KEY: Your real OpenAI API key. Should looks like: sk-123456789012345678901234567890123456789012345678.
  5. Use your worker domain as endpoint and DUMMY_WRAPPER_KEY as api key. Profit.

ai-gateway-openai-wrapper's People

Contributors

pokon548 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.