DeepSeek meets Obsidian

Integration made easy with Copilot and OpenRouter.AI

Brian Perron, PhD
6 min readJun 26, 2024
Image by author. Path in a small park at East China University of Science and Technology.

I recently conducted workshops on Python and AI at East China University of Science and Technology, where I forged new friendships with highly motivated and very kind colleagues. Although I haven’t written on Medium, a colleague’s question about integrating DeepSeek with Obsidian inspired me. I’m a fan of both tools and was delighted by how seamlessly they work together. Here, I’ll explain why I integrated them and introduce a few new technologies — CoPilot and OpenRouter.AI, the underlying technology enhancing their functionality.

Why Obsidian?

Markdown is integral to your workflow in data science and AI, whether you’re coding in Jupyter notebooks, messaging on Slack, Discord, or Reddit, or documenting on GitHub. You need a Markdown editor, and Obsidian is a lightweight yet powerful option that works seamlessly across devices. It’s fully featured, making it ideal for translating PDFs into Markdown for AI processing, note-taking, and slide creation. Obsidian’s capabilities are impressive — and it is free, which makes it even more remarkable!

Why DeepSeek?

I’ve been spending a lot of my time in the AI space, trying to remain current with all AI tools, especially large language models (LLMs). No single model fits all my needs; each has distinct features, leading me to switch between them based on the task. DeepSeek, a Chinese LLM, consistently stands out. It outperforms many top US models on various benchmarks and is accessible to my Chinese colleagues without a VPN. Most notably, it’s incredibly affordable at just $0.14 per million input tokens and $0.28 per million output tokens, compared to $5.00 and $15.00 for OpenAI’s ChatGPT-4o. DeepSeek’s capabilities cover most of my tasks, excelling in English and Chinese writing, translation, and Python coding. New users receive 5 million free tokens — that will last a long time!

Why integrate Obsidian and DeepSeek?

I can access DeepSeek for free via its web interface, but constantly copying and pasting disrupts my workflow. Integrating LLMs into my tools, like coding assistants in VS Code, has been beneficial. However, I still need seamless integration in my writing. Integrating DeepSeek into Obsidian allows me to perform summarization, editing, and translation tasks directly within the editor without leaving it. While there’s a cost for using the DeepSeek API, it’s cheap. This integration offers convenience and enhances my workflow by allowing me to maintain a flow state without task-switching interruptions.

The Magic of Copilot for Obsidian

Setting up DeepSeek with Obsidian was challenging until I came across Copilot for Obsidian, an open-source package maintained by Logan Yang. I am super-impressed by Logan’s work and willingness to make it freely available. Within a few minutes, I got everything up and running, and this was the first time I ever used OpenRouter.AI. You can figure out everything from the excellent documentation from various sources. Still, I hope to make your life easier by pulling everything together in this short article.

API keys

You will first need API keys from two different providers. API keys are like passwords, so do not share them with others.

1. DeepSeek: Create an account with DeepSeek and visit their API platform to obtain your API key. You will only see the key once, so I suggest creating an Obsidian note to save it. You can give your API any name—it doesn’t matter.

2. OpenRouter: Go to OpenRouter.ai and create an account. OpenRouter is a special service that provides a unified interface for connecting large language models. This service opens up a world of opportunities for testing different types of models. After creating an account, click the dropdown and find “keys.”

Create a new key, giving it any name you like. Ignore the “credit limit field.” And, again, save this key in an Obsidian note with your DeepSeek key.

Copilot installation

Ok, now, let’s get Copilot installed in Obsidian. I assume you have already installed Obsidian on your computer. If not, do that first. Go to your settings and look for “Community Plugins.” You will need to turn on community plugins:

After turning on community plugins, browse the plugins for Copilot by Logan Yang. Then, click to install:

Configuring Copilot and Obsidian

Here, you have to pay attention to details. Return to the community plugins tab in your settings and turn on Copilot. Copilot must be turned on for the plugin to work!

Go to the settings in Copilot, where we will configure the API. The first thing to do is change the default model to OPENROUTER.AI. This is the service that is connecting our model to DeepSeek.

Now, put your DeepSeek API key in the OpenAI API key box. Yes, you heard me — your DeepSeek API key goes into the OpenAI API key box!

Now, go to the OpenRouter.AI API settings and add your API key. Change the model to “deepseek/deepseek-chat”. I obtained the model name and this configuration by searching OpenRouter from the provided link.

Now, you must save and reload to make the settings take effect. After you do this, double-check that all the settings are saved. If you navigate away from the page during setup, you can lose your changes — so double-check that all the API keys and other configurations were saved.

Test run!

Let’s see some magic! Click on the Copilot icon to open the chat window on the right side of the screen.

Go ahead and enter a chat and push send. It should work perfectly!

Next, you will want to familiarize yourself with many built-in prompts and set the Hotkeys to make them accessible. Go to your Obsidian settings and scroll down to find the Copilot Hotkeys. Here, you can configure your Hotkeys by simply pushing the plus button + and the keys you want to access.

For example, I have the Copilot: Translate set up to translate text quickly. My Hotkey for this operation is Option 1. So, I highlight a passage and select Option 1, which brings up a menu for different target languages.

Like magic, I get the translation in my Copilot tab that I can quickly put into my note!

You can also create custom prompts for standard tasks.

Copilot also has other features for using the LLM to access your notes, allowing you to perform queries over your entire collection of notes.

What’s next?

This is just a starting point for integrating an LLM. There are many other features that you can leverage to advance your work. In this article, I have focused on integrating DeepSeek, but you can also connect with different models through OpenRouter, including a few free models! But the excitement doesn’t stop with just OpenRouter. I could also quickly integrate Ollama with Copilot, allowing me to run local models. Perhaps that will be my next article!

--

--

Brian Perron, PhD

I’m a Professor of Social Work at the University of Michigan. I’ve also been up since 4am drinking coffee. https://www.linkedin.com/in/brian-perron-6465507/