opencode icon indicating copy to clipboard operation
opencode copied to clipboard

DeepSeek API not working

Open clockmike opened this issue 1 year ago • 11 comments

Using DeepSeek provider, I get an error "AI_APICallError: Incorrect API key provided: sk-********__. You can find your API key at https://platform.openai.com/account/api-keys.

I have verified the API Key is correct, has credit, and I even tried a new API key.

It does this for every prompt I give it.

v0.1.109

I would guess it's trying to use OpenAI URL instead of DeepSeek's?

It does this on DeepSeek Chat and Reasoner models.

clockmike avatar Jun 20 '25 14:06 clockmike

Can you share you opencode.json file? And do you have a global openai api key loaded in your env?

cravenceiling avatar Jun 20 '25 15:06 cravenceiling

No opencode.json file exists on my entire machine. There's a ~/.opencode/ directory, but no .json files in it. There's no json file or opencode folders or files in my project directory either.

Doesn't exist: ~/.config/opencode/config.json Doesn't exist: opencode.json (in project directory or anywhere in my home folder)

env and export does not show any OPENAI* variables.

I made the mistake of adding opencode.ai/opencode a couple weeks ago, so maybe that completely screwed up my settings and scattered crud all over.

clockmike avatar Jun 20 '25 15:06 clockmike

It's indeed not working, I've tested it

douglarek avatar Jun 21 '25 02:06 douglarek

Yea I tested on my clean install linux box, it gives me the same problem. :-(

seemikeplay avatar Jun 21 '25 03:06 seemikeplay

It will always attempt to use the OpenAI endpoint rather than Deepseek.

ipfans avatar Jun 22 '25 05:06 ipfans

I think it's working now (v0.1.123), can confirm?

cravenceiling avatar Jun 23 '25 22:06 cravenceiling

yep should be fixed

thdxr avatar Jun 23 '25 22:06 thdxr

Thanks, it works

❯ opencode run -m deepseek/deepseek-chat "what's opencode?" 

█▀▀█ █▀▀█ █▀▀ █▀▀▄ █▀▀ █▀▀█ █▀▀▄ █▀▀
█░░█ █░░█ █▀▀ █░░█ █░░ █░░█ █░░█ █▀▀
▀▀▀▀ █▀▀▀ ▀▀▀ ▀  ▀ ▀▀▀ ▀▀▀▀ ▀▀▀  ▀▀▀

>  what's opencode?

@  deepseek/deepseek-chat

|  webfetch  https://opencode.ai (text/html)
|  Text     opencode is an AI coding agent built for the terminal, featuring a native TUI, LSP support, multi-session capability, and compatibility with 75+ LLM providers. Learn more at [opencode.ai](https://opencode.ai).

ipfans avatar Jun 24 '25 02:06 ipfans

Not sure if it's related, but after downloading opencode via homebrew and opening it, the following error pops up. I don't know if there's any place in openCode to find more relevant error logs. I searched and didn't seem to find any other related issues, and I haven't had time to try other APIs yet.

Image

by the way

❯ brew list --versions  sst/tap/opencode
opencode 0.1.126

jensenojs avatar Jun 24 '25 07:06 jensenojs

@jensenojs This should be a separate bug, you can open a new issue.

ipfans avatar Jun 24 '25 07:06 ipfans

@jensenojs This should be a separate bug, you can open a new issue.

I upgrade to v0.1.133, and it seems ok, When I encounter this bug again, I'll file a new issue. I'm currently still a Cursor/WindSurf user, but this is a great project. I'm considering gradually migrating my workflow to Neovim. Thank you, this project has given me more confidence.

jensenojs avatar Jun 25 '25 12:06 jensenojs