index.mdx 4.1 KB

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