Learning Timeline
Key Insights
The Advantage of Local Context
OpenCode automatically reads files in your current directory. This means you can switch AI models (e.g., from Grok to Claude) mid-conversation without losing project context, as all conversation data is stored locally.
Free Grok Access
OpenCode currently has special access to Grok AI, allowing users to use Grok models for free directly from the CLI without needing their own API key.
Step by Step
How to Install and Set Up OpenCode
- Open your Terminal or Command Prompt.
- Type the installation command (refer to the snippet) to download and install OpenCode globally.
- Launch the tool by typing `opencode` in the terminal.
- Wait for the TUI (Terminal User Interface) to appear.
- By default, you will immediately enter 'Grok Code' mode, which is provided for free through a partnership with Grok AI.
How to Integrate Local LLMs (Llama 3.2)
- Exit the OpenCode interface by typing `exit` or pressing Ctrl+C.
- Open the configuration file using a text editor (e.g., Nano) with the command: `nano ~/.config/opencode/opencode.jsonc`.
- Insert the JSON settings for the local provider (Ollama) into the file.
- Save the file (Ctrl+O, Enter) and exit (Ctrl+X).
- Relaunch OpenCode by typing `opencode`.
- Inside the OpenCode interface, type the `/model` command and select `llama3.2` (or your installed local model) to start chatting offline.
How to Connect Your Claude Pro Subscription
- In the terminal, type the command `opencode auth login`.
- Select 'Anthropic' or 'Claude' from the list of providers.
- The terminal will generate a unique code and automatically open your browser.
- Log in to your Claude Pro account in the browser and paste the provided code.
- Return to the terminal and launch `opencode`.
- Use the `/model` command and select `claude-3-5-sonnet` to use the premium model within the terminal.
Experimental Features: Share & Timeline
- While in a chat session, type the `/share` command to share the AI conversation.
- A unique URL will be automatically copied to your clipboard; paste the URL into your browser to view the live conversation log.
- Use the `/timeline` command to view the history of changes or 'checkpoints' within the conversation.
- Select any point in the timeline to 'restore' or return to that phase of the conversation if you want to change the direction of the AI's output.