Skip to content

Commit

Permalink
Require API key to run the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubno committed Aug 30, 2023
1 parent 5cdeb63 commit 9547fdf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .well-known/ai-plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name_for_human": "E2B code interpreter",
"name_for_model": "e2bcodeintepreter",
"description_for_human": "Sandboxed cloud environment where you can run any process, use filesystem and access the internet",
"description_for_model": "Plugin for writting and reading files and running processes in a cloud environment.",
"description_for_model": "Plugin for writing and reading files and running processes with access to the internet in a cloud environment.",
"auth": {
"type": "none"
},
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ To install the required packages for this plugin, run the following command:
npm install
```

To run the plugin, enter the following command:
To run the plugin, you will need **API Key**. Click [here](https://e2b.dev/docs?reason=sdk-missing-api-key) to get your API key.

Then enter the following command:

```bash
npm run dev
E2B_API_KEY=*** npm run dev
```

Once the local server is running:
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import { readFileSync } from 'fs'
import { RegisterRoutes } from './generated/routes'
import { defaultPort } from './constants'

const apiKey = process.env.E2B_API_KEY
if (!apiKey) throw new Error('E2B_API_KEY is not set. Please visit https://e2b.dev/docs?reason=sdk-missing-api-key to get your API key.')

export const app = express()

app.use(
Expand Down
1 change: 1 addition & 0 deletions src/sessions/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class CachedSession {
constructor(envID: string) {
this.session = new Session({
id: envID,
apiKey: process.env.E2B_API_KEY,
onClose: () => {
this.delete()
},
Expand Down

0 comments on commit 9547fdf

Please sign in to comment.