Skip to main content

Overview

The basic-connector allows you to proxy requests to any external API while leveraging UniSkill’s centralized billing, authentication, and rate-limiting systems. It is ideal for integrating niche APIs that aren’t yet available as specialized UniSkill skills.

Usage

Send a POST request to /v1/basic-connector with the target url and optional method, headers, or body.

Parameters

ParameterTypeRequiredDescription
urlstringYesThe absolute URL of the target API.
methodstringNoHTTP method (Default: GET, recommended: GET or POST).
headersobjectNoCustom headers to pass to the target.
bodyanyNoJSON payload for the target request.

Smart Interception & Safety

The Basic Connector includes built-in safety features:
  • Upstream Error Mapping: If the target service returns a 402 (billing issue), UniSkill maps it to a 502 to avoid confusion with your UniSkill balance.
  • Header Sanitization: We strip potentially harmful transport headers (like Content-Encoding) when returning diagnostic errors to prevent client-side crashes.

Response Headers

HeaderDescription
X-UniSkill-StatusSuccess or Upstream-Error.
X-UniSkill-Error-SourceIndicates if the error occurred at the Gateway or Upstream.
X-RateLimit-RemainingRemaining requests based on your tier.
X-UniSkill-BalanceCredits remaining after the proxy call.

Code Example

import requests

def proxy_request(target_url):
    gateway_url = "https://api.uniskill.ai/v1/basic-connector"
    payload = {
        "url": target_url,
        "method": "POST",
        "body": {"query": "test"}
    }
    headers = {"Authorization": "Bearer YOUR_KEY"}
    
    response = requests.post(gateway_url, json=payload, headers=headers)
    return response.json()