API Reference¶
This document provides a comprehensive reference for the Bluefly LLM API. The API serves as the central interface for accessing LLM functionality across the ecosystem.
Base URL¶
https://api.bluefly.io/v1
Authentication¶
All API requests require authentication using API keys. Include the API key in the header:
Authorization: Bearer YOUR_API_KEY
Endpoints¶
Authentication¶
Login¶
POST /auth/login
Authenticate a user and get an access token.
Request Body:
{
"username": "[email protected]",
"password": "password"
}
Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_in": 3600
}
Refresh Token¶
POST /auth/refresh
Refresh an access token.
Request Body:
{
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expires_in": 3600
}
Models¶
List Models¶
GET /models
Get a list of available models.
Response:
{
"models": [
{
"id": "bluefly-rfp-server",
"version": "v20250401123045",
"description": "RFP analysis model",
"created_at": "2025-04-01T12:30:45Z"
},
{
"id": "bluefly-content-enhancer",
"version": "v20250330145622",
"description": "Content enhancement model",
"created_at": "2025-03-30T14:56:22Z"
}
]
}
Get Model Information¶
GET /models/{model_id}
Get information about a specific model.
Response:
{
"id": "bluefly-rfp-server",
"version": "v20250401123045",
"description": "RFP analysis model",
"created_at": "2025-04-01T12:30:45Z",
"parameters": {
"embedding_dim": 768,
"max_tokens": 4096,
"temperature": 0.7
},
"performance": {
"accuracy": 0.85,
"precision": 0.88,
"recall": 0.82,
"f1": 0.85
}
}
Run Model Inference¶
POST /models/inference
Run inference using a specific model.
Request Body:
{
"model": "bluefly-rfp-server",
"input": "This is the content to analyze...",
"parameters": {
"temperature": 0.7,
"max_tokens": 1000
}
}
Response:
{
"model": "bluefly-rfp-server",
"version": "v20250401123045",
"output": "Analysis results here...",
"processing_time": 0.456
}
RFP Operations¶
Analyze RFP¶
POST /rfp/analyze
Analyze an RFP document.
Request Body:
{
"document": "Base64 encoded document or text content",
"format": "pdf",
"options": {
"extract_requirements": true,
"identify_sections": true
}
}
Response:
{
"analysis": {
"sections": [
{
"title": "Introduction",
"content": "...",
"page": 1
},
{
"title": "Requirements",
"content": "...",
"page": 3,
"items": [
{
"id": "REQ-001",
"text": "The system must...",
"type": "functional"
}
]
}
],
"metadata": {
"title": "RFP for System Implementation",
"issuer": "Example Corp",
"due_date": "2025-05-01"
},
"summary": "This RFP seeks..."
}
}
Generate Response¶
POST /rfp/generate
Generate content for an RFP response.
Request Body:
{
"analysis_id": "analysis-123",
"sections": ["executive_summary", "technical_approach"],
"templates": {
"executive_summary": "template-001",
"technical_approach": "template-002"
},
"parameters": {
"tone": "professional",
"detail_level": "high"
}
}
Response:
{
"content": {
"executive_summary": "Generated executive summary...",
"technical_approach": "Generated technical approach..."
},
"metadata": {
"word_count": 1500,
"estimated_reading_time": "7 minutes"
}
}
Get Templates¶
GET /rfp/templates
Get available response templates.
Response:
{
"templates": [
{
"id": "template-001",
"name": "Executive Summary",
"description": "Standard executive summary template",
"variables": ["client_name", "project_scope"]
},
{
"id": "template-002",
"name": "Technical Approach",
"description": "Detailed technical approach template",
"variables": ["technologies", "methodology"]
}
]
}
Learning System¶
Submit Feedback¶
POST /learning/feedback
Submit feedback for model improvement.
Request Body:
{
"model": "bluefly-rfp-server",
"input": "Original input content",
"output": "Model-generated output",
"corrected_output": "Human-corrected output",
"rating": 4,
"comments": "Output was good but missed some key points"
}
Response:
{
"feedback_id": "feedback-123",
"status": "received",
"message": "Feedback will be processed for future model improvements"
}
Export Content¶
POST /learning/export
Export content for model training.
Request Body:
{
"content": "Content to be added to the training dataset",
"metadata": {
"source": "drupal",
"content_type": "article",
"tags": ["technology", "ai"]
},
"annotations": {
"quality": "high",
"relevance": "relevant"
}
}
Response:
{
"export_id": "export-123",
"status": "received",
"message": "Content will be processed for inclusion in training data"
}
Error Handling¶
The API uses standard HTTP status codes to indicate success or failure:
- 200: Successful operation
- 400: Bad request (invalid parameters)
- 401: Unauthorized (invalid or missing API key)
- 403: Forbidden (insufficient permissions)
- 404: Resource not found
- 429: Too many requests (rate limit exceeded)
- 500: Internal server error
Error responses follow this format:
{
"error": {
"code": "invalid_input",
"message": "The input parameter is invalid",
"details": {
"field": "temperature",
"issue": "Value must be between 0 and 1"
}
}
}
Rate Limits¶
The API enforces rate limits to ensure fair usage:
- 100 requests per minute per API key
- 1000 requests per hour per API key
- 10000 requests per day per API key
Rate limit headers are included in all responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1617184800
Versioning¶
The API uses URL versioning:
/v1/
- Current stable version/v2/
- Next generation (when available)
API changes within a version are backward compatible. Breaking changes are introduced in new major versions.