Call Inference APIs

This section details critical endpoints for calling inference APIs, covering the OpenAPI Specification, cost estimations, and path patterns of inference APIs. These endpoints ensure seamless integration and practical usage, providing all necessary information for utilizing inference services.

Call Inference APIs

Endpoint Structure

The Call Inference API is accessed via a dynamic endpoint with the following path pattern:

/api/{hash}/{handle}/{version}

For premium plan accounts with customized domains, you should exclude the hash part. Your users can access the endpoint as:

https://YourName.xinfer.ai/api/{handle}/{version}

Use this customized domain pattern for inference API calls only. The standard path pattern under https://api.xinfer.ai always works.

Supported Methods

  • GET
  • PUT
  • POST

Path Details

  1. /api/: This is the base path for all inference API calls.
  2. {hash}: A unique identifier for standard accounts. Omitted for premium accounts with customized domains.
  3. {handle}: Represents the specific inference or model being called.
  4. {version}: Indicates the version of the inference or model.

Open API Specification

The Open API specification for the Call Inference API varies based on the hash, handle, and version provided in the endpoint. Each combination of these parameters corresponds to a unique Open API spec.

Security and Security Schemes

All APIs include the following security snippets in their Open API Specification:

components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    inQuery:
      in: query
      name: key
      type: apiKey

security:
  - bearerAuth: []
  - inQuery: []

These security schemes ensure that the APIs are accessed securely, using either a bearer token or an API key passed in the query parameters.

Validation and Design Decision

The API's design dictates that it does not perform validation against the Open API specification. Clients and API providers are responsible for ensuring that API calls conform to the appropriate Open API spec.

This approach allows for greater flexibility and adaptability, enabling clients to implement custom validation mechanisms tailored to their specific needs.

Endpoints Section

List Available APIs

This endpoint and method list Inference APIs by pagination. It returns the list of available inference APIs. Any authenticated user can access it. The id sorts the list in descending order. The id is the API's unique identifier. It uses cursor-based pagination.

Endpoint/utils/inferences/list/v1
MethodGET
Tagsplatform, inferences, list APIs
API PlaygroundClick Here
GET
https://api.xinfer.ai/utils/inferences/list/v1
# This tab is intentionally left blank.

Get A Call Example

Get a call example identified by method and endpoint. Any authenticated user can access this endpoint.

Endpoint/utils/call-examples/by-endpoint/v1
MethodGET
Tagsplatform, call examples, by endpoint
API PlaygroundClick Here
GET
https://api.xinfer.ai/utils/call-examples/by-endpoint/v1
# This tab is intentionally left blank.

Get OpenAPI Spec By Endpoint

Get OpenAPI Spec of an API by method and ednpoit in query string. The API can be an inference API or a platform API. It is public, and any authenticated user can access it. If the inference API still needs to be published, it will return 404. If the open API spec is found, it will return the open API spec in YAML format.

Endpoint/utils/openapi-specs/by-endpoint/v1
MethodGET
Tagsplatform, openapi-spec, by endpoint
API PlaygroundClick Here
GET
https://api.xinfer.ai/utils/openapi-specs/by-endpoint/v1
# This tab is intentionally left blank.

Cost Estimation By Endpoint

This API gives the minium, maxumun and estimated average cost of 1000 requests for an inference API. The inference API is identified by endpoint and method in query string. It is public, and any authenticated user can access it. If the API is not published, it returns 404 not found.

Endpoint/utils/inferences/cost-by-endpoint/v1
MethodPOST
Tagsplatform, inferences, cost estimation, by endpoint
API PlaygroundClick Here
POST
https://api.xinfer.ai/utils/inferences/cost-by-endpoint/v1
# This tab is intentionally left blank.

Was this page helpful?