OpenAI API Tester
Build, run and copy OpenAI Chat Completions API requests as cURL, Python and JavaScript.
Building the request and the cURL, Python and JavaScript code happens locally in your browser. When you press Run, your OpenAI API key and prompt are sent directly from your browser to OpenAI — not to ArrayKit. Your key is kept in browser memory only and is never stored or sent to ArrayKit. Avoid using production keys on shared or public machines.
Test the Claude API
About OpenAI API Tester
The OpenAI API Tester lets you build, run and copy OpenAI Chat Completions requests without leaving your browser. Paste your OpenAI API key, pick a model like gpt-4o or gpt-4o-mini, set max tokens, and write a prompt — the tool assembles a valid POST to https://api.openai.com/v1/chat/completions and generates ready-to-use cURL, Python and JavaScript snippets. Where CORS allows, press Run to send the request directly from your browser to OpenAI and inspect the raw JSON response. It is built for developers checking that a new key works, prototyping a prompt, debugging a 401 or rate-limit error, or copying a tested request straight into their app. The request and code are constructed locally in the browser; your key is only used to call OpenAI when you choose to run it.
Features
- Builds a valid POST to https://api.openai.com/v1/chat/completions with messages and max_tokens
- Model suggestions for gpt-4o, gpt-4o-mini, gpt-4-turbo, o1-mini and gpt-3.5-turbo
- Run requests directly from the browser where CORS allows and view the raw JSON response
- Generates copy-ready cURL, Python and JavaScript for the same request
- Adjustable max tokens and editable model field for any Chat Completions model
- Authorization: Bearer header wired up automatically from your pasted key
- Show/hide toggle for the API key field so it stays out of view on screen
- Switch between cURL, Python and JavaScript tabs and copy with one click
How to use the OpenAI API Tester
- Paste your OpenAI API key (sk-…) into the key field
- Pick or type a model such as gpt-4o-mini and set max tokens
- Write your prompt in the prompt box
- Press Run to send the request and read the JSON response
- Open the cURL, Python or JavaScript tab and copy the code
Common errors & troubleshooting
- Run fails with a CORS / network error in the browser — OpenAI may block cross-origin browser calls; copy the generated cURL or Python and run it from a terminal or your backend instead.
- 401 Incorrect API key provided — Check the key is active and copied in full (starts with sk-), and that it belongs to the right OpenAI organization or project.
- 429 rate limit or insufficient_quota — You have hit a rate limit or have no remaining credit; wait and retry, or add billing in the OpenAI dashboard.
- 404 model not found — The model name is wrong or your account lacks access; use a model you can call, e.g. gpt-4o-mini.
- Response is cut off mid-sentence — Increase the Max tokens value so the completion has room to finish.
Frequently asked questions
- What is the OpenAI API Tester?
- It is an ArrayKit tool that builds an OpenAI Chat Completions request from your key, model and prompt, lets you run it where CORS allows, and gives you copy-ready cURL, Python and JavaScript for the same call.
- Is my OpenAI API key safe to paste here?
- The request and code are built locally in your browser. When you press Run, your key and prompt are sent directly from your browser to OpenAI, never to ArrayKit, and the key is kept in browser memory only — it is not stored or sent to ArrayKit. Avoid using production keys on shared machines.
- Why does Run sometimes fail when the cURL works?
- Browsers enforce CORS, so a direct browser call can be blocked even when the request is valid. Copy the generated cURL or Python and run it from a terminal or backend instead.
- Which models can I test?
- Any Chat Completions model your account can access. The tool suggests gpt-4o, gpt-4o-mini, gpt-4-turbo, o1-mini and gpt-3.5-turbo, and you can type any other model name.
- Can I get Python and JavaScript code, not just cURL?
- Yes. Switch between the cURL, Python and JavaScript tabs to copy the exact same request in your preferred language.
- Does the tool store my prompts or responses?
- No. The prompt is used to build and run the request; ArrayKit does not store your prompts, keys or responses on a server.
Related tools
- Anthropic Claude API Tester — Build, run and copy Anthropic Claude Messages API requests as cURL, Python and JavaScript.
- Google Gemini API Tester — Build, run and copy Google Gemini generateContent API requests as cURL, Python and JavaScript.
- Replicate API Tester — Build, run and copy Replicate prediction API requests as cURL, Python and JavaScript.
- Hugging Face API Tester — Build, run and copy Hugging Face Inference API requests as cURL, Python and JavaScript.
- API Request Client — Send HTTP requests, build headers and params, inspect responses — your last 25 requests are saved locally.
- cURL to Fetch — Convert a curl command to a JavaScript fetch() call.
- Basic Auth Generator — Generate and decode HTTP Basic Auth Authorization headers from a username and password.
- URL Parser — Break a URL into its parts and list query parameters.
All ArrayKit tools