index.mdx 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. ---
  2. title: "Get started"
  3. description: "Get started with OpenCode."
  4. ---
  5. <Callout type="warning">
  6. These docs are for the beta version of OpenCode, which will become OpenCode 2.0. The beta is still changing: things
  7. may break, and APIs, configuration, and plugin APIs may change.
  8. </Callout>
  9. <Callout type="note">
  10. OpenCode 2 installs and runs as `opencode2`. It does not replace OpenCode 1's `opencode` binary, so you can keep both
  11. versions installed and run them side by side.
  12. </Callout>
  13. ## Install
  14. <CodeGroup>
  15. ```bash npm
  16. npm install -g @opencode-ai/cli@beta
  17. ```
  18. ```bash bun
  19. bun install -g --trust @opencode-ai/cli@beta
  20. ```
  21. ```bash pnpm
  22. pnpm add -g --allow-build=@opencode-ai/cli @opencode-ai/cli@beta
  23. ```
  24. ```bash yarn
  25. yarn global add @opencode-ai/cli@beta
  26. ```
  27. ```bash curl
  28. curl -fsSL https://raw.githubusercontent.com/anomalyco/opencode/v2/install | bash
  29. ```
  30. </CodeGroup>
  31. The package uses a trusted postinstall script to select the native `opencode2` binary for your platform. The Bun and pnpm
  32. commands above explicitly allow that script to run.
  33. ### Homebrew
  34. Homebrew installation is not available in beta.
  35. ### Arch Linux
  36. Arch Linux installation is not available in beta.
  37. ### Windows
  38. <Callout type="tip">
  39. For the best experience on Windows, install [Windows Subsystem for Linux
  40. (WSL)](https://learn.microsoft.com/windows/wsl/install), open your Linux distribution, and use one of the beta package
  41. manager commands above.
  42. </Callout>
  43. <Tabs>
  44. <Tab title="chocolatey">Chocolatey installation is not available in beta.</Tab>
  45. <Tab title="scoop">Scoop installation is not available in beta.</Tab>
  46. <Tab title="mise">Mise installation is not available in beta.</Tab>
  47. <Tab title="docker">Docker installation is not available in beta.</Tab>
  48. </Tabs>
  49. Standalone binaries are not available in beta.
  50. ---
  51. #### Prerequisites
  52. To use OpenCode in your terminal, you'll need:
  53. 1. A modern terminal emulator like:
  54. - [Ghostty](https://ghostty.org), Linux and macOS
  55. - [WezTerm](https://wezterm.org), cross-platform
  56. - [Alacritty](https://alacritty.org), cross-platform
  57. - [Kitty](https://sw.kovidgoyal.net/kitty/), Linux and macOS
  58. 2. API keys for the LLM providers you want to use.
  59. ---
  60. ## Connect
  61. With OpenCode you can use any LLM provider by configuring its API key.
  62. Run `/connect` in the TUI and select your provider.
  63. ```text
  64. /connect
  65. ```
  66. If you'd like easy access to all the best coding models you can try out
  67. [OpenCode Console](https://console.opencode.ai).
  68. You can also try [OpenCode Go](https://opencode.ai/go) a $10/month subscription
  69. plan that grants you access to the best open source models.
  70. Use `/models` to browse the providers and models available to your project. See [Providers](/providers) for connection and
  71. configuration details.
  72. ---
  73. ## Usage
  74. You are now ready to use OpenCode in your project. Here are a few common workflows.
  75. ### Ask questions
  76. Ask OpenCode to explain your codebase.
  77. <Callout type="tip">Use `@` to fuzzy search for files in the project.</Callout>
  78. ```text
  79. How is authentication handled in @packages/functions/src/api/index.ts
  80. ```
  81. ### Add features
  82. Ask OpenCode to add a feature by describing the desired behavior and providing relevant context.
  83. ```text
  84. When a user deletes a note, flag it as deleted in the database.
  85. Create a screen that shows recently deleted notes.
  86. From this screen, the user can restore a note or permanently delete it.
  87. ```
  88. <Callout type="tip">Give OpenCode plenty of context and examples.</Callout>
  89. ### Undo changes
  90. Use `/undo` when a change isn't what you wanted.
  91. ```text
  92. /undo
  93. ```
  94. OpenCode stages a conversation revert and restores your original message so you can revise it. In a Git repository, it
  95. also restores file changes when snapshots were captured successfully. Run `/undo` multiple times to move the conversation
  96. boundary back, or use `/redo` to restore the staged conversation and files. See [Undo](/snapshots) for
  97. limitations and safety details.
  98. ```text
  99. /redo
  100. ```
  101. ---
  102. ## Customize
  103. Make OpenCode your own by [picking a theme](/themes), [customizing
  104. keybinds](https://opencode.ai/docs/keybinds), [configuring formatters](/formatters), [creating commands](/commands), or
  105. editing the [OpenCode config](/config).