> For the complete documentation index, see [llms.txt](https://onairos.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://onairos.gitbook.io/docs/developer-guides/integrate-onairos-mobile/manual-api-call/using-the-inference-api.md).

# Using the Inference API

*The Inference API provides a machine learning model that can generate predictions based on the provided data. This documentation will guide you on how to properly format your input for the API and interpret the results received from the API.*

#### Input Format

Send a POST request to the API endpoint with a JSON payload containing a set of entries for prediction. Each entry should include the following information:

* `text`: The text input for the inference result (String) - required
* `category`: The category to which the content belongs (String) - required
* `img_url`: The URL of an image associated with the content (String) - optional

Example JSON body for the POST request:

```json

  "Input": {
    "input1": {
      "text": "Example text input 1",
      "category": "Example Category 1",
      "img_url": "http://example.com/image1.jpg"
    },
    "input2": {
      "text": "Example text input 2",
      "category": "Example Category 2",
      "img_url": "http://example.com/image2.jpg"
    },
    "input3": {
      "text": "Example text input 3",
      "category": "Example Category 3",
      "img_url": "http://example.com/image3.jpg"
    },
  }
    // Additional entries can be added here
  

```

You can then call the Inference API with the Inference object created above.

Remember to include the access token in the Authorization header of your API request.

```jsx
Future<void> onResolved(String apiUrl, String accessToken) async {
    try {
      final response = await http.post(Uri.parse(apiUrl), headers: {
        // If required, add headers for the request
        "Authorization": accessToken,
        "Content-Type": "application/json",
        },
        body: JSON.stringify(InputData),
      );

      if (response.statusCode == 200) {
        final Map<String, dynamic> data = jsonDecode(response.body);
        // process Onairos Data
  
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://onairos.gitbook.io/docs/developer-guides/integrate-onairos-mobile/manual-api-call/using-the-inference-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
