Code Plagiarism
Detection API
Build plagiarism detection into your apps. Check code against 20+ billion sources.
AI Integration Guide
Learn how to use Codequiry with AI coding assistants, integrate AI detection into your workflows, and build AI-powered plagiarism checking solutions.
Using Codequiry with AI Assistants
AI coding assistants like ChatGPT, GitHub Copilot, and Claude can help you integrate Codequiry's API faster. Here's how to leverage them effectively.
Prompt Template for AI-Assisted Integration
I need to integrate the Codequiry plagiarism detection API into my application.
API Base URL: https://codequiry.com/api/v1
Authentication: API key in the "apikey" header
The workflow is:
1. POST /check/create - Create a check with {name, language}
2. POST /check/upload - Upload ZIP files with {check_id, file}
3. POST /check/start - Start analysis with {check_id, test_type}
4. POST /check/status - Poll until status_id = 4
5. POST /check/overview - Get results
Please build a complete integration class in [YOUR_LANGUAGE] that:
- Handles authentication
- Creates a check, uploads files, starts analysis
- Polls for completion with 30-second intervals and a 10-minute timeout
- Returns the plagiarism results
- Includes error handling for 401, 404, and 422 responses
[YOUR_LANGUAGE] with your target language (Python, JavaScript, Java, etc.) for a ready-to-use integration.
How AI Detection Works
Codequiry's AI detection analyzes code submissions to identify patterns consistent with AI-generated code from tools like ChatGPT, GitHub Copilot, Claude, and other LLMs.
Detection Methodology
Pattern Analysis
Identifies characteristic formatting, naming conventions, and structural patterns typical of AI-generated code.
Statistical Modeling
Uses statistical models trained on millions of human-written and AI-generated code samples to compute probability scores.
Style Consistency
Evaluates coding style consistency within a file. AI-generated code tends to have unusually uniform formatting.
Multi-Signal Fusion
Combines multiple detection signals for higher accuracy, reducing false positives through ensemble analysis.
Risk Level Thresholds
| Risk Level | AI Probability | Interpretation | Recommended Action |
|---|---|---|---|
| High | >= 70% | Strong indicators of AI-generated code | Requires manual review and potential follow-up with student |
| Medium | 45-69% | Some AI assistance indicators present | Flag for review; may indicate partial AI use |
| Low | < 45% | Primarily human-written code | No action needed; natural coding patterns detected |
Complete Integration Example
A full example showing how to create a check, upload files, run analysis, and process both plagiarism and AI detection results.
class CodequiryClient {
constructor(apiKey) {
this.apiKey = apiKey;
this.baseUrl = 'https://codequiry.com/api/v1';
}
async request(endpoint, data = {}) {
const response = await fetch(`${this.baseUrl}${endpoint}`, {
method: 'POST',
headers: {
'apikey': this.apiKey,
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
});
if (!response.ok) throw new Error(`API error: ${response.status}`);
return response.json();
}
async runFullAnalysis(name, language, files) {
// Step 1: Create check
const check = await this.request('/check/create', { name, language });
console.log(`Created check: ${check.id}`);
// Step 2: Upload files
for (const file of files) {
const formData = new FormData();
formData.append('check_id', check.id);
formData.append('file', file);
await fetch(`${this.baseUrl}/check/upload`, {
method: 'POST',
headers: { 'apikey': this.apiKey },
body: formData
});
}
// Step 3: Start analysis
await this.request('/check/start', { check_id: check.id, test_type: 1 });
// Step 4: Poll for completion
const status = await this.pollStatus(check.id);
// Step 5: Get results
const overview = await this.request('/check/overview', { check_id: check.id });
const aiResults = await this.request('/ai-results', { assignment_id: check.id });
return { check, overview, aiResults };
}
async pollStatus(checkId, timeoutMs = 600000) {
const start = Date.now();
while (Date.now() - start < timeoutMs) {
const status = await this.request('/check/status', { check_id: checkId });
if (status.status_id === 4) return status;
if (status.status_id === 5) throw new Error('Analysis failed');
console.log(`Progress: ${status.progress}%`);
await new Promise(r => setTimeout(r, 30000));
}
throw new Error('Timeout');
}
}
// Usage
const client = new CodequiryClient('YOUR_API_KEY');
const results = await client.runFullAnalysis('Assignment 1', 14, files);
// Process AI detection results
results.aiResults.submissions.forEach(sub => {
if (sub.ai_detection.risk_level === 'high') {
console.log(`FLAGGED: ${sub.filename} - ${sub.ai_detection.avg_ai_probability}% AI`);
}
});
LMS Integration Patterns
Common patterns for integrating Codequiry with Learning Management Systems.
Canvas / Moodle
Download submissions via LMS API, zip each student's files, upload to Codequiry, then push results back as grades/comments.
Webhook-Driven
Configure LMS webhooks to trigger Codequiry checks automatically when students submit assignments.
Batch Processing
Use batch upload to process entire class submissions at once after the assignment deadline.
Dashboard Integration
Pull summary statistics and AI detection results into your LMS dashboard for instructor review.
CI/CD Pipeline Integration
Add plagiarism detection to your CI/CD pipeline to automatically check code contributions.
GitHub Actions Example
name: Plagiarism Check
on:
pull_request:
types: [opened, synchronize]
jobs:
plagiarism-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create submission ZIP
run: |
zip -r submission.zip src/ -x "*.git*" "node_modules/*"
- name: Run plagiarism check
env:
CODEQUIRY_API_KEY: ${{ secrets.CODEQUIRY_API_KEY }}
run: |
# Create check
CHECK=$(curl -s -X POST "https://codequiry.com/api/v1/check/create" \
-H "apikey: $CODEQUIRY_API_KEY" \
-d "name=PR-${{ github.event.number }}" \
-d "language=14")
CHECK_ID=$(echo $CHECK | jq -r '.id')
# Upload and start
curl -s -X POST "https://codequiry.com/api/v1/check/upload" \
-H "apikey: $CODEQUIRY_API_KEY" \
-F "check_id=$CHECK_ID" \
-F "[email protected]"
curl -s -X POST "https://codequiry.com/api/v1/check/start" \
-H "apikey: $CODEQUIRY_API_KEY" \
-d "check_id=$CHECK_ID&test_type=1"
# Poll for results (simplified)
for i in $(seq 1 20); do
sleep 30
STATUS=$(curl -s -X POST "https://codequiry.com/api/v1/check/status" \
-H "apikey: $CODEQUIRY_API_KEY" \
-d "check_id=$CHECK_ID")
STATUS_ID=$(echo $STATUS | jq -r '.status_id')
if [ "$STATUS_ID" = "4" ]; then break; fi
done
echo "Plagiarism check complete for PR #${{ github.event.number }}"