Installation Guide
ExplainThis can be installed and used in multiple ways. Choose the method that best fits your workflow.
Web Interface
The web interface requires no installation. Simply visit ExplainThis.ai to get started.
SDK Installation
Our SDKs provide programmatic access to ExplainThis features. Choose your preferred language:
JavaScript/TypeScript
Latest: v1.0.0
NPM
npm install @explainthis/sdk
Yarn
yarn add @explainthis/sdk
pnpm
pnpm add @explainthis/sdk
Python
Latest: v1.0.0
pip
pip install explainthis
poetry
poetry add explainthis
Configuration
After installation, you'll need to configure your API key. We recommend using environment variables:
Environment Variables
# .env file
EXPLAINTHIS_API_KEY=your_api_key_hereUsage Example
Here's a quick example of using ExplainThis in your code:
TypeScript Example
import { ExplainThis } from '@explainthis/sdk';
import dotenv from 'dotenv';
// Load environment variables
dotenv.config();
// Initialize the client
const explainer = new ExplainThis({
apiKey: process.env.EXPLAINTHIS_API_KEY
});
// Example usage
async function explainCode() {
const code = `
function quickSort(arr) {
if (arr.length <= 1) return arr;
const pivot = arr[0];
const left = arr.slice(1).filter(x => x < pivot);
const right = arr.slice(1).filter(x => x >= pivot);
return [...quickSort(left), pivot, ...quickSort(right)];
}
`;
try {
const explanation = await explainer.explain(code, {
mode: 'standard',
language: 'javascript'
});
console.log(explanation);
} catch (error) {
console.error('Error:', error);
}
}
explainCode();Next Steps
- Set up API authentication - Get your API key
- Explore basic examples - Learn through examples
- API endpoints - View all available endpoints