Getting started overview

This guide provides a structured approach to initiating development with Inferdo's computer vision APIs. It covers the essential steps from account creation and API key retrieval to executing a foundational request. Inferdo offers capabilities for tasks such as image recognition, object detection, and custom model training, designed for integration into various applications requiring automated visual analysis Inferdo documentation.

The core process involves:

  1. Creating an Inferdo account.
  2. Generating API credentials (API key).
  3. Installing a client library or preparing an HTTP request.
  4. Sending an authenticated request to an Inferdo API endpoint.
  5. Processing the API response.

Quick Reference Guide

Step What to Do Where
1. Sign Up Register for a new Inferdo account. Inferdo homepage
2. Get API Key Locate and copy your unique API key from the dashboard. Inferdo dashboard (after login)
3. Choose SDK/Method Decide between a supported SDK (Python, Node.js) or direct HTTP. Inferdo API reference
4. Install SDK (if applicable) Install the chosen SDK using package managers like pip or npm. Command line
5. Make First Request Write and execute code to send an image to an Inferdo endpoint. Your development environment
6. Handle Response Parse the JSON response to extract relevant data. Your development environment

Create an account and get keys

Before making any API calls, you need an Inferdo account and a valid API key. This key authenticates your requests and links them to your usage quota.

Account Creation

  1. Navigate to the Inferdo website.
  2. Click on the "Sign Up" or "Get Started Free" button.
  3. Provide the required information, typically an email address and a password.
  4. Complete any email verification steps.

Upon successful registration, you will usually be directed to your Inferdo dashboard. Inferdo offers a free tier that includes 500 API calls per month, allowing you to test the service without immediate financial commitment.

API Key Retrieval

Your API key is a unique identifier that authorizes your application to interact with Inferdo's services. Keep this key confidential to prevent unauthorized access to your account and usage.

  1. From your Inferdo dashboard, locate the "API Keys" or "Settings" section.
  2. You should see your default API key listed. If not, generate a new one.
  3. Copy the API key to a secure location. You will use this key in the Authorization header or as a query parameter for your API requests.

Some platforms, including Inferdo, may provide different types of API keys for various environments (e.g., test and live keys). Ensure you are using the appropriate key for your development stage. The concept of an API key for authentication is a common practice across many web services Mozilla Developer Network's API key definition.

Your first request

This section demonstrates how to make a basic image recognition request using Inferdo. We will provide examples for both Python and Node.js, reflecting Inferdo's supported SDKs.

Prerequisites

  • An Inferdo API key.
  • An image file (URL or local file) for analysis.
  • Python 3.x or Node.js installed in your development environment.

Python Example (Image Recognition)

First, install the Inferdo Python SDK:

pip install inferdo-sdk

Then, create a Python script (e.g., recognize_image.py):

import os
from inferdo_sdk import InferdoClient

# Replace with your actual API key
API_KEY = os.environ.get("INFERDO_API_KEY")

# Initialize the client
client = InferdoClient(api_key=API_KEY)

# Example image URL (replace with your image)
image_url = "https://docs.inferdo.io/assets/images/sample-image.jpg" # Placeholder

try:
    # Make an image recognition request
    response = client.image_recognition.analyze_url(url=image_url)

    # Print the detected labels
    print("Image Analysis Results:")
    for label in response.labels:
        print(f"- {label.name} (confidence: {label.confidence:.2f})")

except Exception as e:
    print(f"An error occurred: {e}")

To run this script, set your API key as an environment variable:

export INFERDO_API_KEY="YOUR_INFERDO_API_KEY"
python recognize_image.py

Node.js Example (Image Recognition)

First, install the Inferdo Node.js SDK:

npm install inferdo-sdk

Then, create a Node.js script (e.g., recognizeImage.js):

const InferdoClient = require('inferdo-sdk').InferdoClient;

// Replace with your actual API key
const API_KEY = process.env.INFERDO_API_KEY;

// Initialize the client
const client = new InferdoClient(API_KEY);

// Example image URL (replace with your image)
const imageUrl = "https://docs.inferdo.io/assets/images/sample-image.jpg"; // Placeholder

async function analyzeImage() {
  try {
    const response = await client.imageRecognition.analyzeUrl({ url: imageUrl });

    console.log("Image Analysis Results:");
    response.labels.forEach(label => {
      console.log(`- ${label.name} (confidence: ${label.confidence.toFixed(2)})`);
    });
  } catch (error) {
    console.error(`An error occurred: ${error.message}`);
  }
}

analyzeImage();

To run this script, set your API key as an environment variable:

export INFERDO_API_KEY="YOUR_INFERDO_API_KEY"
node recognizeImage.js

Common next steps

After successfully making your first API call, consider these next steps to further integrate Inferdo into your applications:

  • Explore Other APIs: Inferdo offers various computer vision capabilities beyond basic image recognition, such as Object Detection API. Review the API reference for details on available endpoints and their specific parameters.
  • Handle Errors and Edge Cases: Implement robust error handling in your code to manage network issues, invalid inputs, or API-specific errors. Refer to the Inferdo documentation for specific error codes and their meanings.
  • Manage API Keys Securely: Ensure your API keys are not hardcoded in your application and are instead managed using environment variables, secret management services, or secure configuration files. This practice is crucial for application security, as highlighted in general API security guidelines Google Cloud's API key best practices.
  • Monitor Usage: Regularly check your Inferdo dashboard to monitor API call usage against your free tier or paid plan limits. This helps prevent unexpected service interruptions or charges.
  • Implement Webhooks: For asynchronous tasks or real-time notifications, explore Inferdo's webhook capabilities if available. Webhooks can streamline workflows by notifying your application when a long-running process, like custom model training, is complete. While the specific implementation details vary by provider, webhooks offer an efficient mechanism for event-driven communication MDN Web Docs on Webhooks.
  • Custom Model Training: If your use case requires recognizing specific objects or concepts not covered by pre-trained models, investigate Inferdo's Custom Model Training features. This allows you to train models with your own datasets.
  • Review Pricing: As your usage scales beyond the free tier, review the Inferdo pricing page to understand the costs associated with different service levels and usage volumes.

Troubleshooting the first call

Encountering issues during your first API call is common. Here are some troubleshooting steps:

  • Check API Key:
    • Is it correct? Double-check that you have copied the full and accurate API key from your Inferdo dashboard.
    • Is it expired or revoked? Log into your Inferdo account to ensure your API key is still active.
    • Is it in the right place? Confirm the API key is being sent correctly, either in the Authorization header (e.g., Authorization: Bearer YOUR_API_KEY) or as a designated query parameter, as specified in the Inferdo API reference.
  • Network Issues:
    • Connectivity: Verify your internet connection.
    • Firewall/Proxy: If you are on a corporate network, ensure that firewalls or proxies are not blocking outgoing requests to Inferdo's API endpoints.
  • Request Payload/Parameters:
    • JSON Format: If sending a JSON body, ensure it is well-formed and valid. Use a JSON validator if necessary.
    • Required Fields: Confirm that all mandatory parameters (e.g., url for image analysis) are included in your request, as outlined in the Inferdo API documentation.
    • Image Accessibility: If providing an image URL, ensure the URL is publicly accessible and correctly points to an image file. Test the URL directly in a browser.
  • Error Messages:
    • Read the response: The API response typically includes an HTTP status code and an error message in the body. These messages are crucial for diagnosing the problem.
    • Common HTTP codes:
      • 400 Bad Request: Often indicates an issue with the request's format or missing parameters.
      • 401 Unauthorized: Usually means an incorrect or missing API key.
      • 403 Forbidden: Could indicate insufficient permissions or an expired API key.
      • 404 Not Found: The requested endpoint might be incorrect.
      • 429 Too Many Requests: You have exceeded your rate limits or usage quota.
      • 5xx Server Error: Indicates an issue on Inferdo's side; typically, these are temporary.
  • SDK Specific Issues:
    • Installation: Ensure the Inferdo SDK is correctly installed and up to date.
    • Version Compatibility: Check if your SDK version is compatible with the Inferdo API version you are targeting.
  • Inferdo Status Page: Check the Inferdo status page (if available) for any ongoing service outages or maintenance.
  • Contact Support: If you've exhausted these steps, refer to Inferdo's support resources or contact their technical support team for assistance.