Skip to main content

OpenAI API Tester

OpenAI API Tester is a tool designed to interact with APIs compatible with OpenAI's format. It uses the FastAPI framework and HTMX to provide a seamless interface for quickly testing various APIs. Form inputs are stored in the browser's local storage, so you can pick up where you left off.

Installation

To install the necessary dependencies, use the uv package manager:

uv tool install openai-api-tester
openai-api-tester

or pipx:

pipx install openai-api-tester
openai-api-tester

You can also launch the application one-shot:

uvx  openai-api-tester
pipx run openai-api-tester

Deploy on Clever Cloud

Install Clever Tools and create a Python application:

npm i -g clever-tools
clever login

clever create --type python

Set the environment variables:

clever env set CC_RUN_COMMAND "uvx openai-api-tester"
clever env set ALLOWED_HOSTS "your-app.cleverapps.io"

ALLOWED_HOSTS is required: the application only answers requests whose Host header it lists, and it defaults to localhost,127.0.0.1, so a deployed instance returns 400 Invalid host header until its public domain is set. Give the hostname alone, without a scheme or port, and list every domain the application is served under. Whatever sits in front of the application must pass the public Host through unchanged — X-Forwarded-Host is not used. Redeploy or restart after changing the value.

Deploy the application:

clever deploy
clever open

Reaching it from another device

The server listens on all interfaces, so a phone or another machine on the same network can use it — but its Host must be listed too, alongside the loopback names you keep for local use:

export ALLOWED_HOSTS=localhost,127.0.0.1,192.168.1.42,workstation.local

Development

To run the application locally, clone the repository use the development script:

git clone https://github.com/davlgd/openai-api-tester.git
cd openai-api-tester

uv run dev.py

TLS configuration

Outgoing calls verify TLS certificates against certifi by default. Four optional environment variables cover private CAs and mutual TLS:

Variable Effect
SKIP_TLS_VERIFY true (case-insensitive, surrounding spaces ignored) disables certificate verification entirely; anything else is read as false, and a value that is neither is logged as invalid
CUSTOM_CA_BUNDLE CA bundle used to verify the server: a PEM file, or an OpenSSL hashed directory
CLIENT_CERT_PATH Client certificate for mutual TLS
CLIENT_KEY_PATH Client key, when it is not already inside the certificate file

ALLOWED_HOSTS, described under Deploy on Clever Cloud, applies whether or not any of these TLS settings are used.

export ALLOWED_HOSTS=openai.example.com
export CUSTOM_CA_BUNDLE=/path/to/ca-bundle.pem
export CLIENT_CERT_PATH=/path/to/client-cert.pem
export CLIENT_KEY_PATH=/path/to/client-key.pem

The CA in use is resolved in this order: SKIP_TLS_VERIFY, then CUSTOM_CA_BUNDLE, then the standard SSL_CERT_FILE and SSL_CERT_DIR, then certifi. Directory paths, for CUSTOM_CA_BUNDLE as well as SSL_CERT_DIR, need OpenSSL's hash links: run openssl rehash /path/to/certs first, otherwise verification fails even though the certificates are there. A misconfiguration — a missing file, a path that is not a regular file, a key without its certificate, an encrypted key — is reported in the response panel rather than silently ignored. CLIENT_CERT_PATH alone is valid if that file also carries the key; the key itself must not be passphrase-protected.

These settings are global to the instance, and the application has no authentication. /api-call accepts any destination from anyone who can reach it, so a client certificate configured here is an identity that every visitor can use, against any host they choose. Set CLIENT_CERT_PATH only on an instance whose access you control — not on a public deployment.

Network access control is not by itself enough: a page on another site can make a visitor's browser submit a form to an instance that browser can reach, including one bound to loopback. /api-call therefore rejects submissions that do not come from the tester's own page, and the application only answers requests whose Host header is in ALLOWED_HOSTS — which is what stops a hostile domain resolving to this instance from satisfying that same-origin check. Neither authenticates anyone who can open the page themselves.

Disabling verification while a client certificate is configured is allowed, since testing an unverified endpoint is the point of SKIP_TLS_VERIFY. Be aware of what it means: the peer is not authenticated, so it receives the certificate and a handshake proof — not the private key, and not a token it could replay elsewhere — while an interceptor can read and alter both the request and its response, including any application tokens they carry.

License

This project is licensed under the Apache License 2.0. See the LICENSE file for details.

Metadata

Release files for openai-api-tester 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openai-api-tester 0.2.0
File Size Uploaded Provenance Actions
openai_api_tester-0.2.0.tar.gz 324.2 kB Without provenance Details for openai_api_tester-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openai-api-tester 0.2.0
File Interpreter ABI Platform Actions
openai_api_tester-0.2.0-py3-none-any.whl Python 3 none any Details for openai_api_tester-0.2.0-py3-none-any.whl

Total release size: 648.9 kB

Release files / openai_api_tester-0.2.0.tar.gz

Download URL openai_api_tester-0.2.0.tar.gz
Size 324.2 kB
Tags Source
SHA-256 checksum
How to use checksums
56562d7dfa413f5e0fccf60cc118cb5edd0c43e7dc40e8f2e63e3e58ec251f23
BLAKE2b-256 checksum
How to use checksums
74f5237a96f46ae92f5625efbd8df700e0d037a096e4516068fbfc1827e3e609
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / openai_api_tester-0.2.0-py3-none-any.whl

Download URL openai_api_tester-0.2.0-py3-none-any.whl
Size 324.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12a5e082323862c471ce2a6023efa9b1d99b0217ff16b399dfc63d0bffa327fb
BLAKE2b-256 checksum
How to use checksums
4f4c9425ac07de68428c9f6b18b1365a3e2e4555e15af61b591a5aeac4fa30ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for openai-api-tester 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page