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
/api/
: This is the base path for all inference API calls.{hash}
: A unique identifier for standard accounts. Omitted for premium accounts with customized domains.{handle}
: Represents the specific inference or model being called.{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 |
---|---|
Method | GET |
Tags | platform, inferences, list APIs |
API Playground | Click Here |
# 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 |
---|---|
Method | GET |
Tags | platform, call examples, by endpoint |
API Playground | Click Here |
# 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 |
---|---|
Method | GET |
Tags | platform, openapi-spec, by endpoint |
API Playground | Click Here |
# 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 |
---|---|
Method | POST |
Tags | platform, inferences, cost estimation, by endpoint |
API Playground | Click Here |
# This tab is intentionally left blank.