To type an OpenAI API payload, paste a chat.completion response into PayloadIQ and it generates TypeScript interfaces and a Zod schema — in your browser, nothing uploaded. The response has a consistent shape (choices[].message, usage, finish_reason) that is worth capturing as types so your code stops indexing into any.
Example chat completion response
A typical non-streaming response from the Chat Completions endpoint:
{
"id": "chatcmpl-AbC123dEf456",
"object": "chat.completion",
"created": 1727200000,
"model": "gpt-4o-mini-2024-07-18",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you today?",
"refusal": null
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 9,
"completion_tokens": 12,
"total_tokens": 21
},
"system_fingerprint": "fp_0123456789"
}What you get back
PayloadIQ infers a ChatCompletion interface with a typed choices array, the nested message object, and a usage block of token counts — plus a Zod schema you can use to validate responses before trusting choices[0].message.content. It is a fast way to bootstrap a typed wrapper around the API without hand-writing the model.
Browser-local by design
The payload is parsed and transformed on your device — useful when a response includes proprietary prompt content or tool-call arguments you would rather not paste into a random online generator.