DEV Community

sheep
sheep

Posted on

Giving DeepSeek a Spin

In my previous post, I mentioned how I used Gemini to implement a one-click bookmark organization feature. The feedback for the feature was quite positive. However, recently I noticed an increase of errors from Gemini, such as occasional 503 errors, empty responses, or timeouts exceeding 1 minute.

I’m not sure if the issues are caused by the lengthy context when processing a large number of bookmarks, or the high frequency of API calls, or simply because I’m using the free tier of Gemini 2.5 Flash. I need some more time to investigate these issues, but before that, I'd like to give DeepSeek a try to handle the categorization and organization. I am very curious to see how it performs.

Using DeepSeek

As introduced in its official documentation, DeepSeek’s API can be called in various way, I simply used axios to invoke it. After obtaining a DeepSeek API key, I reused the same prompt originally designed for Gemini and created a DeepSeek version of the send function.

import axios from 'axios';

const path = 'https://api.deepseek.com/chat/completions';

async function send(content) {
  const data = {
    "messages": [
      {
        "content": content,
        "role": "user"
      }
    ],
    "model": "deepseek-chat",
    "max_tokens": 8192, // max
    "response_format": { "type": "text" },
    "stream": false,
    "temperature": 1,
    "top_p": 1,
  };

  const res = await axios.post(path, data, {
    maxBodyLength: Infinity,
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${process.env.DS_KEY}`
    }
  });

  if (res?.status !== 200) {
    console.error('Failed send res:', res)
    throw new Error()
  }

  const { message } = res?.data?.choices?.[0] || {};
  return message?.content;
}

Enter fullscreen mode Exit fullscreen mode

Switching from Gemini’s send function to DeepSeek’s required no other code changes, the replacement was seamless.

The Chrome extension is now available. I’ll monitor its performance for a while and see if DeepSeek offers better stability. Feel free to check out my extension Bookmark Dashboard, and try out the DeepSeek version of the one-click bookmark organization feature!

Thanks for reading!

Top comments (0)