index.mdx 4.3 KB

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