# Use the API

## Create an API key

To obtain an API key to use with your Fastino model, log in to the Fastino platform. Once logged in, navigate to the "Keys" section on the sidebar. From this section, you can create keys as needed to suit your requirements.&#x20;

{% hint style="warning" %}
The ID visible in your account is not the API key itself; it is merely an identifier. Store your keys in a safe place, you will not be able to retrieve them again after creating.&#x20;
{% endhint %}

{% hint style="warning" %}
When generating a new API key please wait for 60 seconds for the key to propagate&#x20;
{% endhint %}

<figure><img src="/files/iG89iiJEoTcFSUEH2qr7" alt="" width="375"><figcaption><p>Create a model key</p></figcaption></figure>

## Call the API

Fastino's inference API is designed to provide a seamless integration for deploying and running AI models with ease. With a simple `POST` request to the endpoint `https://api.fastino.com/run`, users can efficiently execute their AI models in real-time. The API requires standard authentication, utilizing a bearer token for security, and operates with a straightforward JSON payload that includes essential user details. Suitable for a wide range of AI applications, Fastino's platform ensures quick and reliable model inference, making it an ideal solution for developers looking to leverage powerful AI capabilities into their applications effortlessly.

**Endpoint**

<mark style="color:green;">`POST`</mark> [`https://api.fastino.com/run`](https://api.fastino.com/run)&#x20;

**Headers**

| Name         | Value                                                                                           |
| ------------ | ----------------------------------------------------------------------------------------------- |
| x-api-key    | Your API key generated on the platform (see [#create-an-api-key](#create-an-api-key "mention")) |
| Content-Type | `application/json`                                                                              |

**Body**

<table><thead><tr><th width="215.9794921875">Name</th><th width="152.0712890625">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>model_id</code></td><td>string</td><td>Unique identifier for the model. This value can be copied from the <code>Models</code> screen on the platform UI.</td></tr><tr><td><code>input</code></td><td>array of objects</td><td>An array where each object represents a single model inference call. For PRO and TEAM plans, multiple objects can be included to perform batch inference in a single request. </td></tr><tr><td><code>input > text</code></td><td>string</td><td>The text being processed by the language model</td></tr><tr><td><code>input > parameters</code></td><td>object</td><td>The parameters specifying how the model should process the text. Parameters vary depending on the expected input format of the specific model being used. If not specified, the inference parameters revert to defaults.</td></tr></tbody></table>

{% code title="Example Body" %}

```json
{
  "model_id": "fastino-pii",
  "input": [
    {
      "text": "9 AM for a Sedan for Jamie Derran",
      "parameters": {
        "entity_types": [
          "full_name",
          "car",
          "time"
        ],
        "threshold": 0.3
      }
    }
  ]
}
```

{% endcode %}

**Response**

<table><thead><tr><th width="215.9794921875">Name</th><th width="152.0712890625">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>input</code></td><td>string</td><td><p></p><p>Original user-provided string.</p></td></tr><tr><td><code>latency_ms</code></td><td>number</td><td><p></p><p>Model inference time (excludes network and API gateway latency)</p></td></tr><tr><td><code>output</code></td><td>object</td><td>The output of the model. Structure varies depending on the model being used. </td></tr><tr><td><code>status</code></td><td>string</td><td>Overall request status (e.g., success, error)</td></tr></tbody></table>

{% code title="Example Response" %}

```json
[{
  "input": "9 AM for a Sedan for Jamie Derran",
  "latency_ms": 77.31,
  "message": "Responses from endpoint.",
  "output": {
    "entities": [
      {
        "start": 0,
        "end": 4,
        "label": "time",
        "text": "9 AM",
        "score": 0.5893954038619995
      },
      {
        "start": 11,
        "end": 16,
        "label": "car",
        "text": "Sedan",
        "score": 0.8889331817626953
      },
      {
        "start": 21,
        "end": 33,
        "label": "full_name",
        "text": "Jamie Derran",
        "score": 0.9932531714439392
      }
    ],
    "redacted_text": "<TIME> for a <CAR> for <FULL_NAME>"
  },
  "status": "success"
}]
```

{% endcode %}


---

# Agent Instructions: 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:

```
GET https://fastino-1.gitbook.io/docs/get-started/use-the-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
