Guides9 min readPublished 2026-08-03

How to Test an OpenAI-Compatible API with Postman

Test an OpenAI-compatible API in Postman with Bearer authentication, reusable variables, response assertions, model discovery and an error matrix.

By LumeAPI Engineering Team

OpenAI-Compatible API hub →

Short path: OpenAI-compatible API · API documentation · Available models · Python guide

Last verified: August 3, 2026

To test an OpenAI-compatible API in Postman, create a POST request to /v1/chat/completions, use Bearer authentication, send a raw JSON body with a valid model ID and inspect choices[0].message.content in the response. Postman is useful here because it separates endpoint, authentication, payload and response problems without requiring an SDK.

For LumeAPI, use https://api.lumeapi.site/v1/chat/completions. The key used for model inference is not the Research publishing key.

The five-minute setup

Create an HTTP request in Postman with these values:

FieldValue
MethodPOST
URL{{lumeapi_base_url}}/chat/completions
Authorization typeBearer Token
Tokenyour private lumeapi_api_key value
Bodyraw → JSON
Content-Typeapplication/json

Create an environment variable named lumeapi_base_url with the value:

text
https://api.lumeapi.site/v1

Store the API key in Postman Vault or as a secure local variable. Do not paste a real key into a shared collection, example response, screenshot or exported environment.

Use this request body:

json
{
  "model": "gpt-5.4-mini",
  "messages": [
    {
      "role": "system",
      "content": "Answer accurately and in no more than three sentences."
    },
    {
      "role": "user",
      "content": "Explain what an API gateway does."
    }
  ],
  "temperature": 0
}

Click Send. A successful response should contain an ID, a model field, a choices array and usually a usage object. The generated text is normally at:

text
choices[0].message.content

Add Postman checks so a 200 response is not mistaken for success

Open the post-response script area and add:

javascript
pm.test("status is 200", () => {
  pm.response.to.have.status(200);
});

pm.test("response contains assistant text", () => {
  const data = pm.response.json();
  pm.expect(data.choices).to.be.an("array").that.is.not.empty;
  pm.expect(data.choices[0].message.content).to.be.a("string").and.not.empty;
});

pm.test("usage is non-negative when returned", () => {
  const usage = pm.response.json().usage;
  if (usage) {
    pm.expect(usage.prompt_tokens).to.be.at.least(0);
    pm.expect(usage.completion_tokens).to.be.at.least(0);
  }
});

These checks catch proxy error pages, empty provider responses and unexpected response shapes. They also make a saved collection useful for regression testing after changing a model or base URL.

Test model discovery separately

Create a second request:

text
GET {{lumeapi_base_url}}/models

Use the same Bearer token. Copy an exact model ID from the response before changing the chat request. This isolates a common failure: authentication and the endpoint work, but the selected model name does not.

Do not assume that a model name found in a blog post is still available. Treat the live model catalog and authenticated model-list response as the source of truth.

Import the request from cURL

Postman can import cURL. Replace the placeholder locally before sending, but never save the real key in a shared collection:

bash
curl https://api.lumeapi.site/v1/chat/completions \
  -H "Authorization: Bearer YOUR_LUMEAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model":"gpt-5.4-mini",
    "messages":[{"role":"user","content":"Reply with: connection ok"}],
    "temperature":0
  }'

Importing is convenient, but move the imported key into Vault or a secure variable immediately. The request history and generated snippets can otherwise expose it.

Diagnose failures by layer

SymptomLikely causeUser action
Postman cannot sendDNS, proxy, TLS or local network issueOpen the Postman Console and inspect the transport error
401Missing, invalid or incorrectly prefixed keySelect Bearer Token and verify the inference key
404Wrong base URL, route or modelConfirm /v1/chat/completions and call /v1/models
400Invalid JSON or unsupported request fieldReduce the body to model plus one user message
429Rate or account limitRespect retry guidance; do not hammer Send repeatedly
5xxTransient gateway or upstream failureSave request ID and response, then retry with a bound
200 but no textUnexpected response shape or provider behaviorInspect raw JSON and keep the Postman assertion

If the minimal request succeeds but your application fails, compare the application's actual URL, headers and JSON with Postman. If both fail identically, the issue is probably outside the SDK.

Turn the test into a reusable collection

Keep three requests in one collection:

  1. List Models — confirms key, route and model discovery.
  2. Minimal Chat — confirms the basic response contract.
  3. Application Payload — mirrors the real prompt and optional fields.

Use separate environments for development and production. Keep base URLs and non-secret model IDs in environment variables; keep credentials in Vault. Add tests for the fields your application actually consumes, not every field that happens to appear today.

Postman is a diagnostic client, not the production architecture. Once the contract is proven, move the same values into the server-side SDK or HTTP client described in the OpenAI-compatible API guides.

Sources and verification boundary

The request structure, test script and public LumeAPI routes were checked on August 3, 2026. No private inference key is embedded in this page; run the minimal request with your own key before saving or sharing a collection.

Ready to call these models?

Create a LumeAPI key in under a minute — one OpenAI-compatible gateway for GPT, Claude, Gemini, and more.