Loading video player…

Coding With OpenCode: AI-Assisted Python (Overview)

OpenCode is an open-source AI coding agent that runs in your terminal and lets you analyze and refactor a Python project through conversational commands. In this video course, you’ll install it on your system, set it up with a free Google Gemini API key, and learn the basics of how to use it in your daily programming work.

OpenCode works as a conversational assistant you explicitly direct. Ask it to analyze functions, refactor code, or explain issues. Press Enter to send your query, and you’ll get a response with full awareness of your project context. It supports more than seventy-five AI providers, including Anthropic, OpenAI, and Google Gemini.

If you’re a Python developer who prefers working in the terminal, OpenCode offers deliberate, context-aware assistance and a customizable AGENTS.md configuration file.

Resource mentioned in this lesson: uv

Download

Course Slides (.pdf)

3.1 MB
Download

Sample Code (.zip)

13.3 KB

00:00 Hey there, I’m Rodrigo and it’s a pleasure to welcome you to Coding With OpenCode: AI-Assisted Python, a video course by Real Python. In this course, you’re going to learn about OpenCode, an open-source AI coding agent.

00:14 And in particular, you’re going to install and set up OpenCode on your computer. You’re going to connect OpenCode to a third-party AI provider. You’re going to explore the OpenCode interface and then use it to work on a Python project. By doing that, you’ll also learn about Plan mode and its advantages, and through it, implement and refine features in a Python project without writing a single line of code.

00:40 And finally, you’re going to understand the OpenCode-specific features that improve your user experience when compared to some of the other coding agents that exist out there. As far as prerequisites go, funnily enough, you don’t need any prior Python knowledge.

00:58 It’s very likely that you know some Python, but you will not be writing any Python explicitly in this course. You do need uv, which is a tool that you can use to manage Python projects. You don’t need to be an expert on it, you just need to have it installed, because you’re going to use it to manage the Python projects that you will be working on.

01:19 And you also need an API key from a major model provider. And by major, it really just needs to be supported by OpenCode. So in a couple of lessons, you’re going to see what models and what providers OpenCode supports. But if you have an API key from a major model provider like OpenAI, Anthropic, Google, or any other of those major labs, that should be enough.

01:44 Finally, just a quick note, the prompts you’re going to use throughout this course, they are available in the downloadable materials for your convenience. But remember that LLMs are not deterministic, which means that even if you copy and paste the exact same prompt as you’re going to see in the video course, you might get different results.

02:07 And that’s perfectly fine. You don’t need to get the exact same results, you just need to get results that achieve the same purposes of what you’re shown in this video course.

02:21 So with that out of the way, once you’re ready to set up the Python project that you’re going to be working on, you can move on to the next lesson.

Become a Member to join the conversation.