Skip to main content

A tiny CLI that checks whether an OpenAI API key can call Chat Completions.

Project description

openai-api-availability-test

A tiny CLI that checks whether an OpenAI API key can call Chat Completions.

Usage

pip install -e openai-api-availability-test
openai-api-test --api-key "your_api_key"

The test uses gpt-4.1-nano by default, asks for only one output token, uses https://api.openai.com/v1/ as the default base URL, and has a 10-second timeout.

To use another model:

openai-api-test --api-key "your_api_key" --model gpt-4.1-mini

To use another base URL:

openai-api-test --api-key "your_api_key" --base-url "https://api.openai.com/v1"

To use another timeout:

openai-api-test --api-key "your_api_key" --timeout 30

Python API

from openai_api_availability_test import check_availability

available = check_availability(
    api_key="your_api_key",
    base_url="https://api.openai.com/v1/",
    timeout=30,
)
print(available)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openai_api_availability_test-0.1.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openai_api_availability_test-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file openai_api_availability_test-0.1.0.tar.gz.

File metadata

File hashes

Hashes for openai_api_availability_test-0.1.0.tar.gz
Algorithm Hash digest
SHA256 39696f57bcebeb8de09c7afd5fca4937c90e1881c59ac427158919d65140b7a7
MD5 f3cc40f1d9b2b2d5996d682afe361c31
BLAKE2b-256 20896b2455f04c5df428a0a5c55ffeb4717781fa5d85b1693c532d8b913ecf40

See more details on using hashes here.

File details

Details for the file openai_api_availability_test-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openai_api_availability_test-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fef26aa4322d64cdc8115253675f1d0c5c8f2400bc3be1bc4d0805af7e9c5a52
MD5 38e2138c2ec0de13c5058984b002e64e
BLAKE2b-256 196bb5026171e6d119efb8859cb45b6e5818abaa6b4cf5bca742a1d591e8d4dd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page