Koveh API

FastVLM Vision API

Vision language model for image analysis

FastVLM Vision API

Vision language model for image analysis and understanding using FastVLM models.

Base URL: api.koveh.com/fastvlm/

Endpoints

MethodEndpointDescription
GET/healthService health check
POST/visionAnalyze image with vision model
GET/modelsGet available vision models

Authentication

All endpoints require Bearer token authentication:

curl -H "Authorization: Bearer YOUR_API_KEY" \
  "api.koveh.com/fastvlm/vision"

Image Analysis

Analyze images using FastVLM vision models.

Endpoint: POST /vision

Request Body

{
  "image_url": "https://example.com/image.jpg",
  "prompt": "Describe this image in detail",
  "model": "fastvlm-1.5b",
  "max_tokens": 200,
  "temperature": 0.7
}

Parameters

  • image_url (string, required): URL of the image to analyze
  • prompt (string, required): Text prompt describing what to analyze
  • model (string, optional): Model to use. Default: "fastvlm-1.5b"
  • max_tokens (number, optional): Maximum tokens to generate. Default: 200
  • temperature (number, optional): Sampling temperature (0-2). Default: 0.7

Response

{
  "id": "vision-123",
  "object": "vision.completion",
  "created": 1677652288,
  "model": "fastvlm-1.5b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "This image shows a beautiful sunset over a mountain landscape..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 15,
    "completion_tokens": 45,
    "total_tokens": 60
  }
}

Example Request

curl -X POST "api.koveh.com/fastvlm/vision" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image_url": "https://example.com/image.jpg",
    "prompt": "Describe this image in detail"
  }'

Available Models

Get list of available vision models.

Endpoint: GET /models

Response

{
  "models": [
    {
      "id": "fastvlm-1.5b",
      "name": "FastVLM 1.5B",
      "description": "Fast vision language model for image understanding",
      "max_tokens": 2048,
      "supports_streaming": false
    }
  ]
}

Example Request

curl -X GET "api.koveh.com/fastvlm/models" \
  -H "Authorization: Bearer YOUR_API_KEY"

Health Check

Check service health status.

Endpoint: GET /health

Response

{
  "status": "healthy",
  "timestamp": "2025-08-30T09:19:31.245295",
  "model_loaded": true,
  "gpu_available": true
}

Example Request

curl -X GET "api.koveh.com/fastvlm/health"

Integration Examples

Python Example

import requests

def analyze_image(image_url, prompt):
    response = requests.post(
        "http://api.koveh.com/fastvlm/vision",
        headers={"Authorization": "Bearer YOUR_API_KEY"},
        json={
            "image_url": image_url,
            "prompt": prompt
        }
    )
    return response.json()

# Analyze an image
result = analyze_image(
    "https://example.com/image.jpg",
    "What objects can you see in this image?"
)
print(result['choices'][0]['message']['content'])

JavaScript Example

async function analyzeImage(imageUrl, prompt) {
    const response = await fetch('http://api.koveh.com/fastvlm/vision', {
        method: 'POST',
        headers: {
            'Authorization': 'Bearer YOUR_API_KEY',
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            image_url: imageUrl,
            prompt: prompt
        })
    });
    return await response.json();
}

// Analyze an image
analyzeImage('https://example.com/image.jpg', 'Describe this image')
    .then(result => console.log(result.choices[0].message.content));

Error Handling

The API returns standard error responses:

{
  "error": "Invalid image URL provided",
  "status_code": 400,
  "timestamp": "2025-08-30T09:19:31.245295"
}

Common error codes:

  • 400: Bad Request (invalid parameters)
  • 401: Unauthorized (missing or invalid API key)
  • 404: Not Found (invalid endpoint)
  • 500: Internal Server Error (model or service error)

Rate Limiting

  • Rate Limit: 30 requests per minute
  • Concurrent Requests: 5 simultaneous requests
  • Timeout: 30 seconds per request

Best Practices

  1. Image URLs: Use publicly accessible HTTPS URLs
  2. Image Formats: Supported formats: JPEG, PNG, WebP
  3. Image Size: Maximum 10MB per image
  4. Prompts: Be specific about what you want to analyze
  5. Error Handling: Always check for error responses
  6. Rate Limiting: Implement exponential backoff for rate limit errors

Use Cases

  • Image Description: Generate detailed descriptions of images
  • Object Detection: Identify objects and their relationships
  • Scene Understanding: Analyze the context and setting of images
  • Content Moderation: Detect inappropriate content in images
  • Accessibility: Generate alt text for images
  • E-commerce: Analyze product images for categorization