> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openfiles.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Get file operations working with your AI agent in 2 minutes.

## Prerequisites

* OpenAI API key
* Node.js 18+ or Python 3.8+

## 1. Get API Key

1. Sign in to [console.openfiles.ai](https://console.openfiles.ai) with GitHub
2. Go to API Keys Tab
3. Click "Create API Key"
4. Copy the key (starts with `oa_`)

## 2. Install SDK

<Tabs>
  <Tab title="npm">
    ```bash theme={null}
    npm install @openfiles-ai/sdk
    ```
  </Tab>

  <Tab title="yarn">
    ```bash theme={null}
    yarn add @openfiles-ai/sdk
    ```
  </Tab>

  <Tab title="pnpm">
    ```bash theme={null}
    pnpm add @openfiles-ai/sdk
    ```
  </Tab>

  <Tab title="pip">
    ```bash theme={null}
    pip install openfiles-ai
    ```
  </Tab>
</Tabs>

## 3. Set Environment Variables

```bash theme={null}
export OPENAI_API_KEY="sk_your_openai_key"
export OPENFILES_API_KEY="oa_your_openfiles_key"
```

## 4. Update Your Code

Replace your OpenAI import and add the OpenFiles API key:

<CodeGroup>
  ```typescript TypeScript theme={null}
  import OpenAI from '@openfiles-ai/sdk/openai'  // Changed from 'openai'

  const ai = new OpenAI({
    apiKey: process.env.OPENAI_API_KEY,
    openFilesApiKey: process.env.OPENFILES_API_KEY  // Add this line
  })

  const response = await ai.chat.completions.create({
    model: 'gpt-4',
    messages: [{
      role: 'user',
      content: 'Create a shopping list for making chocolate chip cookies and save it as shopping-list.md'
    }]
  })

  console.log(response.choices[0].message.content)
  ```

  ```python Python theme={null}
  from openfiles_ai import OpenAI  # Changed from 'openai'
  import asyncio
  import os

  async def main():
      ai = OpenAI(
          api_key=os.getenv('OPENAI_API_KEY'),
          openfiles_api_key=os.getenv('OPENFILES_API_KEY')  # Add this line
      )

      response = await ai.chat.completions.create(
          model='gpt-4',
          messages=[{
              'role': 'user',
              'content': 'Create a shopping list for making chocolate chip cookies and save it as shopping-list.md'
          }]
      )
      
      print(response.choices[0].message.content)

  if __name__ == "__main__":
      asyncio.run(main())
  ```
</CodeGroup>

## 5. Run Your Code

Your AI can now create, read, and edit files automatically. The agent will use file operations when it determines they're needed based on the user's request.

## Verify It Works

Try these prompts to test file operations:

```typescript theme={null}
// Create a file
"Create a shopping list for making chocolate chip cookies and save it as shopping-list.md"

// Read a file  
"Read the shopping-list.md file and tell me what's in it"

// Edit a file
"Add butter and vanilla extract to my shopping list"

// List files
"Show me all the files I've created"
```

## What Just Happened?

1. OpenFiles injected 8 file operation tools into your AI
2. The AI chose which tools to use based on your requests
3. Files are stored with automatic versioning
4. Your existing code works exactly the same way

## Next Steps

<CardGroup cols={2}>
  <Card title="OpenAI Integration Guide" icon="robot" href="/guides/openai-integration">
    Learn advanced OpenAI features and configuration
  </Card>

  <Card title="Tools Integration" icon="wrench" href="/guides/tools-integration">
    Use OpenFiles with Anthropic Claude and other AI providers
  </Card>
</CardGroup>
