index.mdx 3.9 KB

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