OpenAI RETIRED TRIVIAL

code-davinci-edit-001 — Retired

Deprecated
Shutdown
2024-01-04
Status
deprecated
Replacement
gpt-4o

Quick fix — copy & paste

Choose your language. The "before" block matches the deprecated call; the "after" block is the drop-in replacement.

Breaks on 2024-01-04
# OpenAI: code-davinci-edit-001 (deprecated)
model = "code-davinci-edit-001"
Use this instead
# Replacement
model = "gpt-4o"

This migration was generated automatically from the model rename. If your code does more than swap a model id, double-check request/response shapes against the official OpenAI migration guide.

Error messages

Seeing one of these? You're in the right place.

  • model_not_found: code-davinci-edit-001
  • The model `code-davinci-edit-001` has been deprecated
  • The model `code-davinci-edit-001` does not exist or you do not have access to it

Replacement options

Other OpenAI deprecations

What this means for your code

code-davinci-edit-001 is a code-completion or code-specific model used for IDE integrations. Code models often have different context window sizes, tokenization, and stop-sequence handling. Replacements may change the prompt format expected for FIM (fill-in-the-middle) completions.

code-davinci-edit-001 was retired by OpenAI on 2024-01-04. API calls now return an error and the model is no longer accessible. New code should use gpt-4o; legacy code that still references this model id needs to be updated immediately.

Find every call in your codebase

Before you change anything, locate every place the deprecated model id is referenced. Search source files, environment files, feature flags, and config repos. Use these commands from your project root:

Python projects

grep -rn '"code-davinci-edit-001"' --include="*.py" .

JavaScript / TypeScript projects

grep -rn '"code-davinci-edit-001"' --include="*.{js,ts,tsx,jsx}" .

Anywhere (configs, scripts, infra)

grep -rn "code-davinci-edit-001" .

Migration checklist

Steps in order. Skip any that don't apply, but read the whole list — for code models, the non-obvious steps are usually the ones that break in production.

  1. 1. Update the model id in your code-completion service
  2. 2. Verify FIM markers (<|fim_prefix|> etc.) are supported by the new model
  3. 3. Re-test completions on representative source files in your supported languages
  4. 4. Recompute cost per accepted suggestion using new tokenizer + new pricing
  5. 5. Update any client-side cache keys that include the model id

Will this migration cost more?

Switching from code-davinci-edit-001 to gpt-4o could change your costs significantly. Calculate the exact difference for your prompts.

Open the cost calculator →