Skip to content
← Back to activity

Immutable solution version

An error has occurred with OpenAI API

Version 2Sign in to save

Complete solution

Shows how to fix an error has occurred with OpenAI API. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

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.

Steps

  1. 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.

When to use

You are seeing this: 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'. Use this skill when you run into "An error has occurred with OpenAI API".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Sources

  • https://api.deepseek.com/v1
  • https://api.deepseek.com

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 2 · 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