Skip to content

Chat Completions is not returning the metatada #1818

@juninhodeluca

Description

@juninhodeluca

Confirm this is a Node library issue and not an underlying OpenAI API issue

  • This is an issue with the Node library

Describe the bug

Hi, I just noticed the metadata key is not being returned in response object when using the https://api.openai.com/v1/chat/completions endpoint despite of the current references says at Create chat completion

Not sure if this is the right place to open this issue, but the openai-openapi looks a bit older.

Request log

[inx-nlp] [SILLY] [69d528cd4d585c4b66e400cf] runFlowExecutionJobWithAxios: making request to https://api.openai.com/v1/chat/completions with body 
{
    "frequency_penalty": 0,
    "presence_penalty": 0,
    "temperature": 0.8,
    "max_completion_tokens": 4096,
    "store": true,
    "model": "gpt-4.1",
    "messages": [
        {
            "role": "system",
            "content": "give a joke about IT support\n\n\n\n"
        }
    ],
    "metadata": {
        "executionId": "69d528cd4d585c4b66e400cf",
        "jobId": "69d528cd4d585c4b66e400da",
        "taskId": "65d4d28ab7b9b5bc5f77db4d"
    }
}

Response log

[inx-nlp] [INFO] [69d528cd4d585c4b66e400cf] runFlowExecutionJobWithAxios: received response from https://api.openai.com/v1/chat/completions: 
{
    "id": "chatcmpl-DS33ORr15wtnJiC5wIvGLIYtb1ubG",
    "object": "chat.completion",
    "created": 1775577294,
    "model": "gpt-4.1-2025-04-14",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Why did the IT support technician refuse to fix the broken elevator?\n\nBecause he didn’t want to deal with another level of abstraction!",
                "refusal": null,
                "annotations": []
            },
            "logprobs": null,
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 19,
        "completion_tokens": 26,
        "total_tokens": 45,
        "prompt_tokens_details": {
            "cached_tokens": 0,
            "audio_tokens": 0
        },
        "completion_tokens_details": {
            "reasoning_tokens": 0,
            "audio_tokens": 0,
            "accepted_prediction_tokens": 0,
            "rejected_prediction_tokens": 0
        }
    },
    "service_tier": "default",
    "system_fingerprint": "fp_380a29fa2d"
}

Instead, when calling with Responses API and store: true, the returned object is ok

Response log

{
    "id": "resp_00097c4351f871410069d53151b790819c9c931e89f3e579a2",
    "object": "response",
    "created_at": 1775579473,
    "status": "completed",
    "background": false,
    "billing": {
        "payer": "developer"
    },
    "completed_at": 1775579475,
    "error": null,
    "frequency_penalty": 0,
    "incomplete_details": null,
    "instructions": "give a joke about IT support\n\n\n\n",
    "max_output_tokens": 128000,
    "max_tool_calls": null,
    "model": "gpt-5.4-2026-03-05",
    "output": [
        {
            "id": "rs_00097c4351f871410069d5315235c0819c84437646492af66c",
            "type": "reasoning",
            "summary": []
        },
        {
            "id": "msg_00097c4351f871410069d53153482c819caf49fd07786dee11",
            "type": "message",
            "status": "completed",
            "content": [
                {
                    "type": "output_text",
                    "annotations": [],
                    "logprobs": [],
                    "text": "Why did the IT support tech break up with the printer?\n\nBecause it had too many paper jams and never communicated clearly."
                }
            ],
            "phase": "final_answer",
            "role": "assistant"
        }
    ],
    "parallel_tool_calls": true,
    "presence_penalty": 0,
    "previous_response_id": null,
    "prompt_cache_key": null,
    "prompt_cache_retention": null,
    "reasoning": {
        "effort": "medium",
        "summary": "detailed"
    },
    "safety_identifier": null,
    "service_tier": "default",
    "store": true,
    "temperature": 1,
    "text": {
        "format": {
            "type": "text"
        },
        "verbosity": "medium"
    },
    "tool_choice": "auto",
    "tools": [],
    "top_logprobs": 0,
    "top_p": 0.98,
    "truncation": "disabled",
    "usage": {
        "input_tokens": 17,
        "input_tokens_details": {
            "cached_tokens": 0
        },
        "output_tokens": 61,
        "output_tokens_details": {
            "reasoning_tokens": 31
        },
        "total_tokens": 78
    },
    "user": null,
    "metadata": {
        "executionId": "69d531514d585c4b66e40850",
        "jobId": "69d531514d585c4b66e4085b",
        "taskId": "65d4d28ab7b9b5bc5f77db4d"
    },
    "output_text": "Why did the IT support tech break up with the printer?\n\nBecause it had too many paper jams and never communicated clearly."
}

To Reproduce

Endpoint: https://api.openai.com/v1/chat/completions
Model: gpt-4.1
Body:

{
    "frequency_penalty": 0,
    "presence_penalty": 0,
    "temperature": 0.8,
    "max_completion_tokens": 4096,
    "store": true,
    "model": "gpt-4.1",
    "messages": [
        {
            "role": "system",
            "content": "give a joke about IT support\n\n\n\n"
        }
    ],
    "metadata": {
        "executionId": "69d528cd4d585c4b66e400cf",
        "jobId": "69d528cd4d585c4b66e400da",
        "taskId": "65d4d28ab7b9b5bc5f77db4d"
    }
}

OS

ubuntu 24

Node version

24.14

Library version

4.104.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions