index.mdx 3.8 KB

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