> For the complete documentation index, see [llms.txt](https://fellou.gitbook.io/fellou/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fellou.gitbook.io/fellou/guides/installation.md).

# Installation

Eko is a JavaScript library that can be used in [Browser Extension](https://eko.fellou.ai/docs/getting-started/installation#browser-extension), [Node.js Enviroment](http://localhost:4321/docs/getting-started/installation#nodejs-environment), and [Web Enviroment](http://localhost:4321/docs/getting-started/installation#web-environment). This guide covers installation and setup for different environments.

### Browser Extension <a href="#browser-extension" id="browser-extension"></a>

When building a browser extension that uses Eko, you’ll need to:

```python
# install cli (used to initialize browser extension projects)pnpm install @eko-ai/eko-cli -g# initialize projecteko-cli init browser-extension-demo
cd browser-extension-demo# install dependenciespnpm install
```

#### Extension Project Structure <a href="#extension-project-structure" id="extension-project-structure"></a>

```python
extension/├── src/│   ├── background/│   │   └── index.ts        # Use Eko here│   ├── content/│   │   └── index.ts│   └── popup/│       └── index.ts├── package.json└── webpack.config.js
```

For a complete example of using Eko in a browser extension, check out our [example extension project](https://github.com/FellouAI/eko-browser-extension).

#### Usage Example <a href="#usage-example" id="usage-example"></a>

```python
import { Eko } from "@eko-ai/eko";import { EkoConfig } from "@eko-ai/eko/types";import { getLLMConfig } from "@eko-ai/eko/extension";
export async function main() {  // Load LLM model configuration  // the current browser plugin project provides a page for configuring LLM parameters  let config = await getLLMConfig();
  // Initialize eko  let eko = new Eko(config as EkoConfig);
  // Generate workflow from natural language description  let workflow = await eko.generate(`    Search for Elon Musk, summarize search results and export as md  `);
  // Execute  await eko.execute(workflow);}
```

### Node.js Environment <a href="#nodejs-environment" id="nodejs-environment"></a>

#### Install <a href="#install" id="install"></a>

```
pnpm install @eko-ai/eko
```

#### Usage Example <a href="#usage-example-1" id="usage-example-1"></a>

```python
import { Eko } from "@eko-ai/eko";import { loadTools } from "@eko-ai/eko/nodejs";
Eko.tools = loadTools();
async function main() {  // Initialize eko  let eko = new Eko({    llm: 'claude',    apiKey: process.env.ANTHROPIC_API_KEY,  });
  // Generate workflow from natural language description  let workflow = await eko.generate(`    Clean up all files in the current directory larger than 1MB  `);
  // Execute  await eko.execute(workflow);}
await main();
```

### Web Environment <a href="#web-environment" id="web-environment"></a>

For web pages, you can include Eko using a module bundler like webpack or use it directly in the browser.

#### Install <a href="#install-1" id="install-1"></a>

```
pnpm install @eko-ai/eko
```

#### Usage Example <a href="#usage-example-2" id="usage-example-2"></a>

```python
import { Eko, ClaudeProvider } from "@eko-ai/eko";import { loadTools } from "@eko-ai/eko/web";
Eko.tools = loadTools();
async function main() {  // Initialize LLM provider  let llmProvider = new ClaudeProvider({    // Please use your API endpoint for authentication and forwarding on the server side, do not expose API keys in the frontend    baseURL: 'https://your-api-endpoint.com',    // User Authentication Request Header    defaultHeaders: {      // 'Authorization': `Bearer ${getToken()}`    }  });
  // Initialize eko  let eko = new Eko(llmProvider);
  // Generate workflow from natural language description  // Eko will automatically select and sequence the appropriate tools  const workflow = await eko.generate(`    Open youtube, Search for Elon Musk, click on the first video, extract and summarize the content, and export as md.  `);
  // Execute  await eko.execute(workflow);}
await main();
```
