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.
Import Paths
// OpenAI integration
import OpenAI from '@openfiles-ai/sdk/openai'
// Tools integration
import { OpenFilesTools } from '@openfiles-ai/sdk/tools'
// Core client
import { OpenFilesClient } from '@openfiles-ai/sdk/core'
Configuration Options
OpenAI Integration
const ai = new OpenAI({
apiKey: string, // OpenAI API key (required)
openFilesApiKey: string, // OpenFiles API key (required)
basePath?: string, // File path prefix (optional)
timeout?: number, // Request timeout ms (default: 60000)
maxRetries?: number // Failed request retries (default: 3)
})
const tools = new OpenFilesTools({
apiKey: string, // OpenFiles API key (required)
basePath?: string, // File path prefix (optional)
timeout?: number, // Request timeout ms (default: 60000)
maxRetries?: number // Failed request retries (default: 3)
})
// Access provider-specific tools
tools.openai.definitions // OpenAI tool definitions
tools.anthropic.definitions // Anthropic tool definitions
Core Client
const client = new OpenFilesClient({
apiKey: string, // OpenFiles API key (required)
baseUrl?: string, // API base URL (default: https://api.openfiles.ai/functions/v1/api)
basePath?: string, // File path prefix (optional)
timeout?: number, // Request timeout ms (default: 60000)
maxRetries?: number // Failed request retries (default: 3)
})
File Constraints
| Constraint | Limit | Notes |
|---|
| File size | 10MB | Per file operation |
| Path length | 1000 characters | Including all path segments |
| Filename length | 255 characters | Per path segment |
| Request timeout | 60 seconds | Configurable up to 300s |
| Concurrent requests | 100 | Per API key |
- Use forward slashes:
folder/subfolder/file.txt
- No leading slashes:
file.txt not /file.txt
- No trailing slashes:
folder/file.txt not folder/file.txt/
- Case sensitive on all platforms
Error Handling
HTTP Status Codes
400 - Bad Request (invalid parameters)
401 - Unauthorized (invalid API key)
404 - Not Found (file doesn’t exist)
409 - Conflict (file already exists for write operations)
413 - Payload Too Large (file exceeds size limit)
429 - Rate Limited (too many requests)
500 - Internal Server Error
SDK Error Types
import { FileOperationError } from '@openfiles-ai/sdk/core'
try {
await client.writeFile({ path: 'file.txt', content: 'hello' })
} catch (error) {
if (error instanceof FileOperationError) {
console.log(error.statusCode) // HTTP status
console.log(error.code) // Error code
console.log(error.message) // Error description
}
}
| Platform | OpenAI Integration | Tools | Core Client |
|---|
| Node.js 18+ | ✅ | ✅ | ✅ |
| Python 3.8+ | ✅ | ✅ | ✅ |
| Deno | ❌ | ✅ | ✅ |
| Bun | ✅ | ✅ | ✅ |
| Edge Runtime | ❌ | ✅ | ✅ |
| Browser | ❌ | ✅ | ✅ |
Choose Your Integration
OpenAI Integration
Easiest: Drop-in replacement for OpenAI SDK with automatic file operations
Tools Integration
Flexible: Works with any AI provider (OpenAI, Anthropic, etc.)
Core Client
Control: Direct API access for custom integrations