API Inspector AI is the companion AI engine for API Inspector, a developer-focused platform for understanding API contracts and inspecting real API behavior.
This repository is developed separately from the main application so that API-specific reasoning, test generation, and result analysis can evolve independently of the Django backend and React frontend.
Development status: Version 1.0 completed.
Both repositories are parts of the same API Inspector product.
- api-inspector: The main application, built with Django REST Framework and React. It handles accounts, authentication, API execution, and user-facing features.
- api-inspector-ai: The companion AI engine, responsible for API context processing, test generation, and AI-assisted result analysis.
The intended integration is service-to-service. The main application provides normalized API context and sanitized inspection results to the AI engine. The AI engine returns structured test plans, findings, and recommendations.
The main application retains responsibility for user accounts, credentials, permissions, HTTP request execution, and security controls. The AI engine does not independently execute arbitrary requests against target APIs.
- API Context Models: Structured representation of API definitions, endpoints, parameters, request bodies, and responses.
- Context Validation: Validation of API context structures and their fields.
- AI Test Generation: Generation of structured API test cases based on API specifications.
- AI Result Analysis: Analysis of test execution results to identify unexpected behavior and potential issues.
- Finding Validation: Validation of generated findings, severity levels, and recommendations.
- Evidence-Based Analysis: Findings are based on supplied test results rather than unsupported assumptions.
- Local AI Integration: Integration with Ollama using the Qwen 2.5 model.
The project includes automated tests covering:
- API context validation.
- AI request and response validation.
- Test case generation.
- Result analysis.
- Invalid model outputs and unsupported findings.
The automated test suite has passed. The engine has also been evaluated using the local Ollama model with both successful and failed API test scenarios.
- The main application supplies normalized API context and sanitized inspection results.
- The AI engine validates the supplied data.
- The AI engine generates test plans or analyzes execution results.
- Structured results are returned to the main application.
- The main application manages execution, permissions, and result storage.
Sensitive credentials and unrestricted target-network access remain outside the AI reasoning layer.
- Python
- Ollama
- Qwen 2.5
- Python dataclasses and enums
- Pytest
api-inspector-ai/
├── app/
│ └── core/
│ ├── ai/
│ │ ├── interface.py
│ │ ├── models.py
│ │ ├── ollama_engine.py
│ │ ├── test_cases.py
│ │ └── validators.py
│ └── context/
│ ├── models.py
│ └── validators.py
├── test_ai_analysis.py
├── test_ai_generation.py
├── test_ai_interface.py
├── test_ollama_connection.py
└── test_context.py
Clone the repository:
git clone https://github.com/Kian-kianmehr/api-inspector-ai.git
cd api-inspector-aiCreate and activate a virtual environment:
python -m venv venv
source venv/bin/activateOn Windows PowerShell:
venv\Scripts\Activate.ps1Install dependencies:
pip install -r requirements.txtRun the automated tests:
python -m pytest -vMake sure Ollama is installed and the Qwen 2.5 model is available locally before running live AI tests.
- Main application: Kian-kianmehr/api-inspector