Hugging Face API Tester
Build, run and copy Hugging Face Inference API requests as cURL, Python and JavaScript.
Building the request and the cURL, Python and JavaScript code happens entirely in your browser. When you press Run, your Hugging Face token and inputs are sent directly from your browser to the Hugging Face Inference API — never to ArrayKit. Your token is held in browser memory only and is never stored or sent to ArrayKit. Avoid using production tokens on shared or public machines.
Try the API Request Client
About Hugging Face API Tester
The Hugging Face API tester lets you build, run and copy Hugging Face Inference API requests without leaving your browser. Enter a model id like mistralai/Mistral-7B-Instruct-v0.2, type your inputs, paste your hf_ token, and ArrayKit assembles the POST to https://api-inference.huggingface.co/models/{model} with the right Authorization: Bearer header and JSON body. It instantly generates ready-to-paste cURL, Python (requests) and JavaScript (fetch) snippets, and where Hugging Face allows cross-origin calls you can press Run to see the live response. It is built for ML engineers, backend developers and prompt tinkerers who want to smoke-test a model, confirm a token works, or grab clean code for an app. The request and all code are built locally in your browser; when you Run, the call goes directly from your browser to Hugging Face.
Features
- Build Hugging Face Inference API requests from a model id and inputs
- Generates the correct POST to /models/{model} with Authorization: Bearer hf_ header
- Copy ready-to-run cURL, Python (requests) and JavaScript (fetch) snippets
- Run the request in the browser when Hugging Face allows the cross-origin call
- Model suggestions like Mistral-7B-Instruct, Meta-Llama-3-8B-Instruct and gpt2
- Sends the standard { "inputs": ... } JSON body the Inference API expects
- Token stays in browser memory only — never stored or sent to ArrayKit
- Inspect the raw JSON response and HTTP status returned by Hugging Face
How to use the Hugging Face API Tester
- Enter a model id such as mistralai/Mistral-7B-Instruct-v0.2
- Type your inputs (for example, a prompt) into the Inputs field
- Paste your Hugging Face token (hf_…) into the token field
- Press Run to send the request, or copy the cURL, Python or JavaScript code
- Read the JSON response and status, then tweak the model or inputs and retry
Example
Input
curl -X POST 'https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2' \
-H 'Authorization: Bearer hf_xxx' \
-H 'Content-Type: application/json' \
-d '{"inputs":"Write a haiku about TypeScript."}'
Output
[{"generated_text":"Types guard every line..."}]
A minimal Hugging Face Inference API call with an hf_ token and JSON inputs.
Common errors & troubleshooting
- The browser Run fails with a CORS error. — The Hugging Face Inference API often blocks cross-origin browser calls. Copy the generated cURL or Python snippet and run it from a terminal or your server instead.
- 401 Unauthorized or Invalid credentials. — Check your token starts with hf_ and is pasted in full, with no spaces. Create or copy a valid token from huggingface.co/settings/tokens.
- 503 with an estimated_time message. — The model is loading (cold start). Wait the estimated seconds and retry, or send the request again — serverless models warm up on first call.
- 404 Model not found. — Verify the model id matches the repo path exactly (owner/name, case-sensitive), e.g. mistralai/Mistral-7B-Instruct-v0.2, and that the model exposes the Inference API.
- Unexpected response shape or a task error. — Different model tasks expect different inputs. For text generation send a string in "inputs"; check the model card on Hugging Face for the exact input format.
Frequently asked questions
- What is the Hugging Face API tester?
- It is an ArrayKit tool that builds Hugging Face Inference API requests from a model id, inputs and your hf_ token, then lets you run them and copy the equivalent cURL, Python and JavaScript code.
- Do I need a Hugging Face token?
- Yes. Inference API calls use an Authorization: Bearer hf_ token. Generate one at huggingface.co/settings/tokens and paste it into the token field.
- Why does Run fail in the browser when the cURL works?
- The Hugging Face Inference API frequently does not send CORS headers for browser requests. The generated cURL or Python snippet runs fine from a terminal or server where CORS does not apply.
- Which models can I test?
- Any model that exposes the serverless Inference API. The tool suggests Mistral-7B-Instruct, Meta-Llama-3-8B-Instruct and gpt2, but you can type any model id like owner/name.
- Is my token safe to use here?
- The request and all code are built locally in your browser. When you press Run, the call goes directly from your browser to Hugging Face, not to ArrayKit, and your token is kept in browser memory only — never stored or sent to ArrayKit. Avoid using production tokens on shared machines.
- Can I generate code for my app?
- Yes. The tool outputs ready-to-paste cURL, Python (requests) and JavaScript (fetch) for the exact request you built, so you can drop it straight into a script or backend.
Related tools
- OpenAI API Tester — Build, run and copy OpenAI Chat Completions API requests as cURL, Python and JavaScript.
- 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.
- 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