What is the completion id, what can it be used for?

The json response from a Completion request returns some basic information about the completion

Such as created, id, model, and object

I figured created is an epoch timestamp, makes sense.

I’m assuming id, is unique to that request, can it be used for anything in the API?
(e.g. retrieving the completion without passing the prompt?)

Does anyone have examples of use cases that leverage that id somehow?

Thank you!

1 Like

Hi there,

I asked ChatGPT (https://chat.openai.com/chat) about that. The answer to “How can one get a previous completion with the openai api? Give an example with CURL.” is:

To retrieve a previous completion with the OpenAI API using curl, you can use the following command:

curl -X GET -H "Authorization: Bearer YOUR_API_KEY" "https://api.openai.com/v1/completions/abc123"

Using a completion ID that looks like cmpl-6TMkpACl8X0wJ..., the result of

curl -X GET -H "Authorization: Bearer MY_API_KEY" \
    https://api.openai.com/v1/completions/COMPLETION_ID

is

{
    "error": {
        "message": "Invalid URL (GET /v1/completions/cmpl-6TMkpACl8X0wJ...)",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}

@PeculiarPath Have you made any progress?

Welcome to the community! Thanks for searching first and finding this similar old thread!

ChatGPT is known to “hallucinate” which means it can give bad information sometimes while making it sound genuine. That seems to be the case here.

As far as I know, there is no way to call an old completion using COMPLETION_ID.

Hope this helps (both of you!)…

Thank you for the human answer!

And do you know if the ID obtained when creating a completion can be used as parameter for requests to other API endpoints?

No problem.

I don’t believe so, but you may want to check the API docs as I don’t regularly use all the endpoints.