Skip to content

DeepSeek API not working #248

Closed
Closed

Description

@clockmike

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.

Activity

  1. cravenceiling commented on Jun 20, 2025

    @cravenceiling
    Contributor

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

  2. self-assigned this
    on Jun 20, 2025
  3. clockmike commented on Jun 20, 2025

    @clockmike
    Author

    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.

  4. douglarek commented on Jun 21, 2025

    @douglarek

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

  5. seemikeplay commented on Jun 21, 2025

    @seemikeplay

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

  6. ipfans commented on Jun 22, 2025

    @ipfans

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

  7. cravenceiling commented on Jun 23, 2025

    @cravenceiling
    Contributor

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

  8. thdxr commented on Jun 23, 2025

    @thdxr
    Member

    yep should be fixed

  9. ipfans commented on Jun 24, 2025

    @ipfans

    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).
    
  10. jensenojs commented on Jun 24, 2025

    @jensenojs
    Contributor

    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
  11. ipfans commented on Jun 24, 2025

    @ipfans

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

  12. jensenojs commented on Jun 25, 2025

    @jensenojs
    Contributor

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

  13. added a commit that references this issue on Jan 4, 2026
    52db56d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions