FG
๐Ÿ’ป Software๐Ÿค– AI & LLMsOpenAI

404 when making createCompletion

Fresh3 days ago
Mar 14, 20260 views
Confidence Score50%
50%

Problem

Describe the bug Some days ago createCompletion request started to return 404 [code block] To Reproduce 1. Run createCompletion Code snippets [code block] ``` OS macOs Node version Node v14.17.4 Library version openai v3.1.0

Error Output

Error: Request failed with status code 404

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix โ€“ Awaiting Verification

Update OpenAI Library and Check Endpoint Configuration

Medium Risk

The 404 error indicates that the requested resource could not be found. This can occur if the API endpoint has changed or if the library version being used is outdated and incompatible with the current API. The OpenAI library version 3.1.0 may not support the latest API endpoints or features, leading to this issue.

Awaiting Verification

Be the first to verify this fix

  1. 1

    Update OpenAI Library

    Ensure that you are using the latest version of the OpenAI library to avoid compatibility issues with the API. Run the following command to update the library.

    bash
    npm install openai@latest
  2. 2

    Verify API Endpoint

    Check the OpenAI API documentation to confirm the correct endpoint for createCompletion. Ensure that your code is pointing to the right URL.

    typescript
    const endpoint = 'https://api.openai.com/v1/completions';
  3. 3

    Check API Key and Permissions

    Ensure that your API key is valid and has the necessary permissions to access the createCompletion endpoint. You can verify this in your OpenAI account settings.

    typescript
    // Example of setting up the API key
    const openai = new OpenAI({ apiKey: 'your-api-key' });
  4. 4

    Test the createCompletion Call

    After updating the library and verifying the endpoint and API key, run the createCompletion function again to see if the issue persists.

    typescript
    const response = await openai.createCompletion({ model: 'text-davinci-003', prompt: 'Hello, world!', max_tokens: 5 });

Validation

Confirm that the createCompletion function returns a valid response instead of a 404 error. Check the response object for expected output and ensure no errors are thrown.

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

openaigptllmapibug