Git Product home page Git Product logo

openai-api-status-checker's Introduction

OpenAI API Status Checker

Open Source FastAPI endpoint to ping OpenAI's servers to see the status of different models. This API checks the following endpoints:

gpt-4
gpt-3.5-turbo
text-davinci-003

It is easy enough to add in additional models, you will need to edit the ping_models.py file inside the app/services folder. Right now this implementation is very basic; you can host this API and call it on regular intervals (5 minutes) to check the status of the APIs. This will allow you to show your users a banner or notification that the APIs are down and to expect a delay in service.

Getting Started

These instructions will help you set up the project and run it on your local machine for development and testing purposes.

Prerequisites

Make sure you have the following software installed on your system:

  • Python 3.8 or higher
  • Pip (Python Package Installer)

Installation

  1. Clone this repository:
git clone https://github.com/aaronleggett96/openai-api-status-checker.git
cd openai-api-status-checker
  1. Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate  # For Linux and macOS
# or
venv\Scripts\activate  # For Windows
  1. Install the required packages:
pip install -r requirements.txt
  1. Set up an environment variable for the OpenAI API key:
export OPENAI_API_KEY=your_openai_api_key  # For Linux and macOS
# or
set OPENAI_API_KEY=your_openai_api_key  # For Windows

Replace your_openai_api_key with your actual OpenAI API key.

  1. Running the Application

Start the development server:

uvicorn app.main:app --reload

The application should now be running on http://localhost:8000/.

Usage

To check the availability of OpenAI's APIs, send a GET request to the /status endpoint with the desired model names as a comma-separated list in the models query parameter. You can search for one at a time, or multiple.

Example:

http://localhost:8000/status?models=gpt-4,gpt-3.5-turbo,text-davinci-003

The response will be a JSON object containing the availability status of the requested models:

{
  "gpt-4": {
    "is_available": "true"
  },
  "gpt-3.5-turbo": {
    "is_available": "true"
  },
  "text-davinci-003": {
    "is_available": "true"
  }
}

Additionally, FastAPI comes with SwaggerUI out-of-the-box. You can access this via the /docs endpoint:

http://localhost:8000/docs

FastAPI SwaggerUI

License

This project is licensed under the MIT License - see the LICENSE file for details.

Fun Fact: I wrote virtually zero of this code, I just got annoyed when I saw someone trying to charge $10pm for it on Twitter. Thanks, GPT-4!

openai-api-status-checker's People

Contributors

aaronleggett96 avatar

Watchers

 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.