Chat completions API
Fully compatible with OpenAI format
A practical guide for migrating from OpenAI Codex/OpenAI API to DeepSeek V4 using OpenAI-compatible endpoints.
Migration note: OpenAI Codex has been deprecated. This guide helps transition existing code to DeepSeek V4's OpenAI-compatible endpoint. Always test thoroughly before production use.
Why migrate from OpenAI Codex
OpenAI Codex was deprecated and integrated into GPT models. DeepSeek V4 offers a code-optimized alternative with an OpenAI-compatible API endpoint, making migration straightforward for most existing integrations.
| Feature | OpenAI Codex | DeepSeek V4 |
|---|---|---|
| Code Generation | Deprecated | Active, optimized |
| API Format | OpenAI API | OpenAI-compatible |
| Model Access | Limited availability | Public API access |
| Pricing | Premium tiers | Competitive rates |
Codebase that previously used OpenAI Codex or OpenAI API
A DeepSeek Platform API key for OpenAI-compatible endpoint
Node.js 18+ or Python 3.8+ environment for API calls
Obtain API key for OpenAI-compatible endpoint
Modify your OpenAI/Codex API calls to use DeepSeek endpoint
Run smoke tests to ensure core features work
# OpenAI-compatible configuration
base_url: "https://api.deepseek.com/v1"
api_key: "<your-deepseek-api-key>"
# Model mapping
default_model: "deepseek-v4-pro[1m]"
fast_model: "deepseek-v4-flash"
# Example cURL
curl https://api.deepseek.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-d '{
"model": "deepseek-v4-pro[1m]",
"messages": [{"role": "user", "content": "Write a Python function"}]
}'Replace OpenAI credentials with DeepSeek equivalents. Keep API keys secure.
| Use Case | OpenAI Format | DeepSeek Notes |
|---|---|---|
| Code Generation | POST /v1/completions or /v1/chat/completions | Change model to deepseek-v4-pro[1m] for best quality |
| Code Editing | Chat completions with edit instructions | Flash model for faster edits, Pro for complex refactors |
| Function Calling | tools/functions in chat completions | Verify function schema compatibility |
Verify API key is valid DeepSeek key, not OpenAI key. Check base URL is https://api.deepseek.com/v1
Use documented DeepSeek model IDs: deepseek-v4-pro[1m] or deepseek-v4-flash. Do not use OpenAI model names like gpt-4
DeepSeek's OpenAI compatibility is high but not 100%. Review compatibility table for edge cases
DeepSeek has different rate limits. Check account dashboard and implement exponential backoff
Compatibility status
DeepSeek's OpenAI-compatible endpoint covers the most commonly used APIs. Review the compatibility status before migration.
Fully compatible with OpenAI format
Legacy completions endpoint supported
Standard tool calling format supported
Server-sent events work as expected
Use separate embeddings endpoint if needed
Not supported via OpenAI compatibility
Not supported via OpenAI compatibility
When migrating from OpenAI to DeepSeek, review your security practices. API keys should never be committed to version control, and rate limiting should be implemented to control costs.
DeepSeek V4 offers Pro and Flash models for different use cases. Use Pro for complex reasoning and high-quality output, Flash for faster responses on simpler tasks.
Monitor your usage through the DeepSeek dashboard and implement caching where appropriate to reduce redundant API calls.
Open the DeepSeek API pricing guideGenerate code from natural language descriptions
Improve existing code structure and quality
Get help identifying and fixing bugs
OpenAI Codex has been deprecated and integrated into GPT models. This guide helps migrate to DeepSeek V4 as an alternative for code-focused AI tasks.
DeepSeek provides an OpenAI-compatible endpoint at https://api.deepseek.com/v1. The request/response format is largely the same, but model IDs and some capabilities differ.
Yes, for most use cases. Update the base URL, API key, and model IDs. Some advanced features may need adjustment per the compatibility table.
Use deepseek-v4-pro[1m] for complex reasoning and high-quality output. Use deepseek-v4-flash for faster responses and simpler tasks.
Yes, DeepSeek's OpenAI-compatible endpoint supports function/tool calling. Verify your function schemas work with the compatibility layer.
DeepSeek's OpenAI compatibility focuses on text/code. Check the current compatibility table for multimodal support status.
A practical guide for migrating from OpenAI Codex/OpenAI API to DeepSeek V4 using OpenAI-compatible endpoints.
Migration note: OpenAI Codex has been deprecated. This guide helps transition existing code to DeepSeek V4's OpenAI-compatible endpoint. Always test thoroughly before production use.
Why migrate from OpenAI Codex
OpenAI Codex was deprecated and integrated into GPT models. DeepSeek V4 offers a code-optimized alternative with an OpenAI-compatible API endpoint, making migration straightforward for most existing integrations.
| Feature | OpenAI Codex | DeepSeek V4 |
|---|---|---|
| Code Generation | Deprecated | Active, optimized |
| API Format | OpenAI API | OpenAI-compatible |
| Model Access | Limited availability | Public API access |
| Pricing | Premium tiers | Competitive rates |
Codebase that previously used OpenAI Codex or OpenAI API
A DeepSeek Platform API key for OpenAI-compatible endpoint
Node.js 18+ or Python 3.8+ environment for API calls
Obtain API key for OpenAI-compatible endpoint
Modify your OpenAI/Codex API calls to use DeepSeek endpoint
Run smoke tests to ensure core features work
# OpenAI-compatible configuration
base_url: "https://api.deepseek.com/v1"
api_key: "<your-deepseek-api-key>"
# Model mapping
default_model: "deepseek-v4-pro[1m]"
fast_model: "deepseek-v4-flash"
# Example cURL
curl https://api.deepseek.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $DEEPSEEK_API_KEY" \
-d '{
"model": "deepseek-v4-pro[1m]",
"messages": [{"role": "user", "content": "Write a Python function"}]
}'Replace OpenAI credentials with DeepSeek equivalents. Keep API keys secure.
| Use Case | OpenAI Format | DeepSeek Notes |
|---|---|---|
| Code Generation | POST /v1/completions or /v1/chat/completions | Change model to deepseek-v4-pro[1m] for best quality |
| Code Editing | Chat completions with edit instructions | Flash model for faster edits, Pro for complex refactors |
| Function Calling | tools/functions in chat completions | Verify function schema compatibility |
Verify API key is valid DeepSeek key, not OpenAI key. Check base URL is https://api.deepseek.com/v1
Use documented DeepSeek model IDs: deepseek-v4-pro[1m] or deepseek-v4-flash. Do not use OpenAI model names like gpt-4
DeepSeek's OpenAI compatibility is high but not 100%. Review compatibility table for edge cases
DeepSeek has different rate limits. Check account dashboard and implement exponential backoff
Compatibility status
DeepSeek's OpenAI-compatible endpoint covers the most commonly used APIs. Review the compatibility status before migration.
Fully compatible with OpenAI format
Legacy completions endpoint supported
Standard tool calling format supported
Server-sent events work as expected
Use separate embeddings endpoint if needed
Not supported via OpenAI compatibility
Not supported via OpenAI compatibility
When migrating from OpenAI to DeepSeek, review your security practices. API keys should never be committed to version control, and rate limiting should be implemented to control costs.
DeepSeek V4 offers Pro and Flash models for different use cases. Use Pro for complex reasoning and high-quality output, Flash for faster responses on simpler tasks.
Monitor your usage through the DeepSeek dashboard and implement caching where appropriate to reduce redundant API calls.
Open the DeepSeek API pricing guideGenerate code from natural language descriptions
Improve existing code structure and quality
Get help identifying and fixing bugs
OpenAI Codex has been deprecated and integrated into GPT models. This guide helps migrate to DeepSeek V4 as an alternative for code-focused AI tasks.
DeepSeek provides an OpenAI-compatible endpoint at https://api.deepseek.com/v1. The request/response format is largely the same, but model IDs and some capabilities differ.
Yes, for most use cases. Update the base URL, API key, and model IDs. Some advanced features may need adjustment per the compatibility table.
Use deepseek-v4-pro[1m] for complex reasoning and high-quality output. Use deepseek-v4-flash for faster responses and simpler tasks.
Yes, DeepSeek's OpenAI-compatible endpoint supports function/tool calling. Verify your function schemas work with the compatibility layer.
DeepSeek's OpenAI compatibility focuses on text/code. Check the current compatibility table for multimodal support status.