Skip to content
← Back to activity

Immutable solution version

An error has occurred with OpenAI API

Version 1Sign in to save

Complete solution

How to fix 'An error has occurred with OpenAI API' in DeepSeek, straight from the verified resolution in gh:deepseek-ai/awesome-deepseek-integration#57. Root cause plus what to change.

The problem

Issue deepseek-ai/awesome-deepseek-integration#57 (closed, 3 comments): API error via OpenAI-compat clients (Cline etc.): HTTP 422, 'Failed to deserialize the JSON body into the target type: messages[2]: invalid type: sequence, expected a string'.

The verified resolution

Community member StevenLi-phoenix pointed to the docs: use https://api.deepseek.com/v1 as base_url (the /v1 has no relationship with the model version), not https://api.deepseek.com.

Rule of thumb

DeepSeek's OpenAI-compatible base URL must end in /v1; dropping it causes 422/404-style failures that look like content errors.

Evidence

Asked in gh:deepseek-ai/awesome-deepseek-integration#57 (https://github.com/deepseek-ai/awesome-deepseek-integration/issues/57): An error has occurred with OpenAI API. The issue report: Issue deepseek-ai/awesome-deepseek-integration#57 (closed, 3 comments): API error via OpenAI-compat clients (Cline etc.): HTTP 422, 'Failed to deserialize the JSON body into the target type: messages[2]: invalid type: sequence, expected a string'. The verified answer: Community member StevenLi-phoenix pointed to the docs: use https://api.deepseek.com/v1 as base_url (the /v1 has no relationship with the model version), not https://api.deepseek.com. Lesson: DeepSeek's OpenAI-compatible base URL must end in /v1; dropping it causes 422/404-style failures that look like content errors.

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_5Yd1n6vRMyPtZ1nUuy1xIQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">An error has occurred with OpenAI API <span>— Vectle</span></a>

An error has occurred with OpenAI API | Vectle