Request Structure

A typical request will have the following structure:

Endpoint

POST https://api.worker.helicone.ai/custom/v1/log

Headers

NameValue
AuthorizationBearer {API_KEY}

Replace {API_KEY} with your actual API Key.

Body

export type HeliconeAsyncLogRequest = {
  providerRequest: ProviderRequest;
  providerResponse: ProviderResponse;
  timing: Timing;
};

export type ProviderRequest = {
  url: "custom-model-nopath";
  json: {
    _type: "vector_db";
    operation: "search" | "insert" | "delete" | "update";
    text?: string;
    vector?: number[];
    topK?: number;
    filter?: object;
    databaseName?: string;
    [key: string]: any;
  };
  meta: Record<string, string>;
};

export type ProviderResponse = {
  json: {
    _type?: "vector_db";
    [key: string]: any;
  };
  status: number;
  headers: Record<string, string>;
};

export type Timing = {
  // From Unix epoch in Milliseconds
  startTime: {
    seconds: number;
    milliseconds: number;
  };
  endTime: {
    seconds: number;
    milliseconds: number;
  };
};

Example Usage

curl -X POST https://api.worker.helicone.ai/custom/v1/log \
-H 'Authorization: Bearer your_api_key' \
-H 'Content-Type: application/json' \
-d '{
  "providerRequest": {
    "url": "custom-model-nopath",
    "json": {
      "_type": "vector_db",
      "operation": "search",
      "text": "sample query text",
      "topK": 3,
      "databaseName": "sample_vector_db"
    },
    "meta": {
      "source": "test_integration",
      "environment": "development"
    }
  },
  "providerResponse": {
    "json": {
      "_type": "vector_db",
      "results": [
        {"id": "doc1", "score": 0.92, "content": "Sample document 1"},
        {"id": "doc2", "score": 0.85, "content": "Sample document 2"},
        {"id": "doc3", "score": 0.78, "content": "Sample document 3"}
      ]
    },
    "status": 200,
    "headers": {
      "content-type": "application/json"
    }
  },
  "timing": {
    "startTime": {
      "seconds": 1625686222,
      "milliseconds": 500
    },
    "endTime": {
      "seconds": 1625686244,
      "milliseconds": 750
    }
  }
}'