---
title: "Modify a stored chat completion. Only Chat Completions that have been
created with the `store` parameter set to `true` can be modified. Currently,
the only supported modification is to update the `metadata` field."
method: POST
path: "/chat/completions/{completion_id}"
tags: ["Chat"]
---

# Modify a stored chat completion. Only Chat Completions that have been
created with the `store` parameter set to `true` can be modified. Currently,
the only supported modification is to update the `metadata` field.

`POST /chat/completions/{completion_id}`

## Path parameters

- `completion_id` string, required

## Request body

- object
  - `metadata` Metadata, nullable, required — Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

## Response `200`

A chat completion

- CreateChatCompletionResponse — Represents a chat completion response returned by model, based on the provided input.
  - `id` string, required — A unique identifier for the chat completion.
  - `choices` object[], required — A list of chat completion choices. Can be more than one if `n` is greater than 1.
    - `finish_reason` 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call', required — The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function.
    - `index` integer, required — The index of the choice in the list of choices.
    - `message` ChatCompletionResponseMessage, required — A chat completion message generated by the model.
      - `content` string, nullable, required — The contents of the message.
      - `refusal` string, nullable, required — The refusal message generated by the model.
      - `tool_calls` union[] — The tool calls generated by the model, such as function calls.
        - union
          - ChatCompletionMessageToolCall — A call to a function tool created by the model.
            - `id` string, required — The ID of the tool call.
            - `type` 'function', required — The type of the tool. Currently, only `function` is supported.
            - `function` object, required — The function that the model called.
              - …
          - ChatCompletionMessageCustomToolCall — A call to a custom tool created by the model.
            - `id` string, required — The ID of the tool call.
            - `type` 'custom', required — The type of the tool. Always `custom`.
            - `custom` object, required — The custom tool that the model called.
              - …
      - `annotations` object[] — Annotations for the message, when applicable, as when using the [web search tool](/docs/guides/tools-web-search?api-mode=chat).
        - `type` 'url_citation', required — The type of the URL citation. Always `url_citation`.
        - `url_citation` object, required — A URL citation when using web search.
          - `end_index` integer, required — The index of the last character of the URL citation in the message.
          - `start_index` integer, required — The index of the first character of the URL citation in the message.
          - `url` string, uri, required — The URL of the web resource.
          - `title` string, required — The title of the web resource.
      - `role` 'assistant', required — The role of the author of this message.
      - `function_call` object — Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
        - `arguments` string, required — The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function.
        - `name` string, required — The name of the function to call.
      - `audio` object, nullable — If the audio output modality is requested, this object contains data about the audio response from the model. [Learn more](/docs/guides/audio).
        - `id` string, required — Unique identifier for this audio response.
        - `expires_at` integer, required — The Unix timestamp (in seconds) for when this audio response will no longer be accessible on the server for use in multi-turn conversations.
        - `data` string, required — Base64 encoded audio bytes generated by the model, in the format specified in the request.
        - `transcript` string, required — Transcript of the audio generated by the model.
    - `logprobs` object, nullable, required — Log probability information for the choice.
      - `content` ChatCompletionTokenLogprob[], nullable, required — A list of message content tokens with log probability information.
        - `token` string, required — The token.
        - `logprob` number, required — The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
        - `bytes` integer[], nullable, required — A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
        - `top_logprobs` object[], required — List of the most likely tokens and their log probability, at this token position. The number of entries may be fewer than the requested `top_logprobs`.
          - `token` string, required — The token.
          - `logprob` number, required — The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
          - `bytes` integer[], nullable, required — A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
      - `refusal` ChatCompletionTokenLogprob[], nullable, required — A list of message refusal tokens with log probability information.
        - `token` string, required — The token.
        - `logprob` number, required — The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
        - `bytes` integer[], nullable, required — A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
        - `top_logprobs` object[], required — List of the most likely tokens and their log probability, at this token position. The number of entries may be fewer than the requested `top_logprobs`.
          - `token` string, required — The token.
          - `logprob` number, required — The log probability of this token, if it is within the top 20 most likely tokens. Otherwise, the value `-9999.0` is used to signify that the token is very unlikely.
          - `bytes` integer[], nullable, required — A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token.
  - `created` integer, required — The Unix timestamp (in seconds) of when the chat completion was created.
  - `model` string, required — The model used for the chat completion.
  - `service_tier` 'auto' | 'default' | 'flex' | 'scale' | 'priority', nullable — Specifies the processing type used for serving the request. - If set to 'auto', then the request will be processed with the service tier configured in the Project settings. Unless otherwise configured, the Project will use 'default'. - If set to 'default', then the request will be processed with the standard pricing and performance for the selected model. - If set to '[flex](/docs/guides/flex-processing)' or '[priority](https://openai.com/api-priority-processing/)', then the request will be processed with the corresponding service tier. - When not set, the default behavior is 'auto'. When the `service_tier` parameter is set, the response body will include the `service_tier` value based on the processing mode actually used to serve the request. This response value may be different from the value set in the parameter.
  - `system_fingerprint` string — This fingerprint represents the backend configuration that the model runs with. Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
  - `object` 'chat.completion', required — The object type, which is always `chat.completion`.
  - `usage` CompletionUsage — Usage statistics for the completion request.
    - `completion_tokens` integer, required — Number of tokens in the generated completion.
    - `prompt_tokens` integer, required — Number of tokens in the prompt.
    - `total_tokens` integer, required — Total number of tokens used in the request (prompt + completion).
    - `completion_tokens_details` object — Breakdown of tokens used in a completion.
      - `accepted_prediction_tokens` integer — When using Predicted Outputs, the number of tokens in the prediction that appeared in the completion.
      - `audio_tokens` integer — Audio input tokens generated by the model.
      - `reasoning_tokens` integer — Tokens generated by the model for reasoning.
      - `rejected_prediction_tokens` integer — When using Predicted Outputs, the number of tokens in the prediction that did not appear in the completion. However, like reasoning tokens, these tokens are still counted in the total completion tokens for purposes of billing, output, and context window limits.
    - `prompt_tokens_details` object — Breakdown of tokens used in the prompt.
      - `audio_tokens` integer — Audio input tokens present in the prompt.
      - `cached_tokens` integer — Cached tokens present in the prompt.

---

[API](https://skmtc.net/openai/apis/openai-api-3.md) · [All operations](https://skmtc.net/openai/apis/openai-api-3/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openai/openai-api-3/versions/74cbcf73838f/schema)
