https://github.com/climactic/markitdown-api
A REST API to Convert Files to Markdown with AI
https://github.com/climactic/markitdown-api
api converter llm markdown markitdown markitdown-api ocr openai python
Last synced: about 1 month ago
JSON representation
A REST API to Convert Files to Markdown with AI
- Host: GitHub
- URL: https://github.com/climactic/markitdown-api
- Owner: Climactic
- License: other
- Created: 2025-03-23T20:38:21.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-03-23T21:14:54.000Z (2 months ago)
- Last Synced: 2025-04-12T03:14:06.150Z (about 1 month ago)
- Topics: api, converter, llm, markdown, markitdown, markitdown-api, ocr, openai, python
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 4
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README

MarkItDown API
A REST API for converting files to markdown using AI
## Features
- Convert files to markdown using Microsoft's markitdown via REST API
- OpenAI integration with customizable host and model
- Authentication with API key## Setup
### Environment Variables
| Variable | Description |
|-------------------------|-----------------------------------------------|
| API_KEY | Your secret API key for authentication |
| ALLOWED_ORIGINS | Comma-separated list of allowed origins |
| OPENAI_API_BASE | Base URL for OpenAI API (optional) |
| OPENAI_API_KEY | Your OpenAI API key (optional) |
| OPENAI_MODEL | The model to use for OpenAI API (optional) |
| DOCS_ENABLED | Enable Swagger/ReDoc docs (default: true) |Copy .env.example to .env and set your values if you're doing this locally.
### Generate API Key
```bash
python generate_api_key.py
```### Production
```bash
docker pull ghcr.io/climactic/markitdown-api:latest
docker run -d -p 8000:8000 -e API_KEY= ghcr.io/climactic/markitdown-api:latest
```Or use the docker-compose.prod.yml file to start the container.
### Local Development
1. Create a virtual environment:
```bash
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
```2. Install dependencies:
```bash
pip install -r requirements.txt
```3. Run the application:
```bash
python run.py
```The API will be available at `http://localhost:8000`.
### Docker Deployment
1. Build and start the Docker container:
```bash
docker-compose up -d
```The API will be available at `http://localhost:8000`.
## API Endpoints
### Convert Markdown to Text
```
POST /convert
```Request:
- Upload a markdown fileHeaders:
- X-API-Key: your_api_key (if authentication is enabled)### Health Check
```
GET /health
```Response:
```json
{
"status": "healthy"
}
```## API Documentation
When the API is running, you can access the interactive API documentation at:
- Swagger UI: `http://localhost:8000/docs`
- ReDoc: `http://localhost:8000/redoc`## Sponsors
Sponsors are welcome to support the development of this project.
You can sponsor us on [GitHub Sponsors](https://github.com/sponsors/climactic).
## License
This project is licensed under the Apache 2.0 License. See the [LICENSE](LICENSE) file for details.