Installing OpenCode
00:00 Once you set up your Python project, go ahead and open the OpenCode documentation and check the installation instructions. Now, you might try and copy the command you’re seeing on the screen directly, but it’s always good to check what the tool itself suggests as the preferred installation method at the time you are watching this recording.
00:25
So go ahead and follow those instructions to install OpenCode on your machine. For this course, let’s use the installation script that’s provided. Once the installation is completed, you can double check that everything went smoothly by running the command opencode --version.
00:45 If you get an error message saying that the command was not found, you may want to check the output of the OpenCode installation because it does mention that OpenCode was successfully added to your path variable.
00:59
So in that case, it might be just a matter of refreshing your terminal settings by running source and then the path to the file in which OpenCode reports it was added to.
01:15
So you give it a second and then you can try running opencode --version again.
01:21 If you get outputs like what you can see on the screen, something that looks like a version number, then the installation was successful. Now the next step is going to be to set up the connection between OpenCode and an AI provider because OpenCode, if you just run it, you’re going to see an interface that’s the interface for your coding agent.
01:46 But OpenCode is just the interface you see plus the harness underneath that determines how your prompts are going to be handled by the agent and what effectively gets sent to the LLM.
02:00 Now the LLM is what you must configure. OpenCode isn’t tied to any particular LLM or to any particular provider. Before being able to use OpenCode to work on your project, you’re going to need to connect it to an AI provider. And that’s why in the prerequisites, it’s mentioned that you need an API key.
02:21
Now to make sure that your provider is supported by OpenCode, you can go ahead and type /models and then you press Enter, and you’re going to see a list that mentions popular providers and those will be the most popular providers that OpenCode supports. You can also press Ctrl A to get a very long list of all the providers that OpenCode supports. And you can see that indeed this list contains hundreds of providers.
02:54 Double check that your provider of choice is supported by OpenCode. And once you’ve made sure you have an API key from one of those supported providers, you can move on to the next lesson where you’re going to establish the connection between OpenCode and your provider.
Become a Member to join the conversation.