> ## Documentation Index
> Fetch the complete documentation index at: https://docs.blaxel.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Inference API

> HTTP reference for the inference endpoints automatically generated when you deploy agents, model APIs, and MCP servers on the Global Agentics Network.

Whenever you deploy a workload on Blaxel, an **inference endpoint** is generated on Global Agentics Network, the [infrastructure powerhouse](../Infrastructure/Global-Inference-Network) that hosts it.

The inference API URL depends on the type of workload ([sandbox](../Sandboxes/Overview), [agent](../Agents/Overview), [model API](../Models/Overview), [MCP server](../Functions/Overview)) you are interacting with:

<CodeGroup>
  ```http Connect to a sandbox's MCP server theme={null}

  https://sbx-{YOUR-SANDBOX}-{YOUR-WORKSPACE}.{REGION}.bl.run/mcp

  ```

  ```http Connect to a sandbox's REST API base URL theme={null}

  https://sbx-{YOUR-SANDBOX}-{YOUR-WORKSPACE}.{REGION}.bl.run/

  ```

  ```http Query agent theme={null}

  POST https://run.blaxel.ai/{YOUR-WORKSPACE}/agents/{YOUR-AGENT}

  ```

  ```http Query model API theme={null}

  POST https://run.blaxel.ai/{YOUR-WORKSPACE}/models/{YOUR-MODEL}

  ```

  ```http Connect to an MCP server theme={null}

  https://run.blaxel.ai/{YOUR-WORKSPACE}/functions/{YOUR-SERVER-NAME}/mcp

  ```

  ```http Execute a job theme={null}

  POST https://api.blaxel.ai/{YOUR-WORKSPACE}/jobs/{YOUR-JOB-NAME}/executions

  ```
</CodeGroup>

Showing the full request, with the input payload:

<Tabs>
  <Tab title="Query sandbox">
    ```http theme={null}
    curl -X GET "https://sbx-{your-sandbox}-{your-workspace}.{region}.bl.run/filesystem/tree/etc" \
    -H "Content-Type: application/json" \
    -H "X-Blaxel-Authorization: Bearer <YOUR_API_KEY>"
    ```

    If you have the Blaxel CLI `bl` installed, you can use it to directly interpolate your API key into the HTTP request, as shown below:

    ```http theme={null}
    curl -X GET "https://sbx-{your-sandbox}-$(bl workspace --current).{region}.bl.run/filesystem/tree/etc" \
    -H "Content-Type: application/json" \
    -H "X-Blaxel-Authorization: Bearer $(bl token)"
    ```
  </Tab>

  <Tab title="Query agent">
    ```http theme={null}
    curl -X POST "https://run.blaxel.ai/{your-workspace}/agents/{your-agent}" \
    -H "Content-Type: application/json" \
    -H "X-Blaxel-Authorization: Bearer <YOUR_API_KEY>" \
    -d '{"inputs":"Hello, world!"}'
    ```

    If you have the Blaxel CLI `bl` installed, you can use it to directly interpolate your API key into the HTTP request, as shown below:

    ```http theme={null}
    curl -X POST "https://run.blaxel.ai/$(bl workspace --current)/agents/{your-agent}" \
    -H "Content-Type: application/json" \
    -H "X-Blaxel-Authorization: Bearer $(bl token)" \
    -d '{"inputs":"Hello, world!"}'
    ```
  </Tab>

  <Tab title="Query model API (example on a chat completion model)">
    ```http theme={null}
    curl -X POST "https://run.blaxel.ai/{your-workspace}/models/{your-model}/chat/completions" \
    -H "Content-Type: application/json" \
    -H "X-Blaxel-Authorization: Bearer <YOUR_API_KEY>" \
    -d '{"messages":[{"role":"user","content":"Hello!"}]}'
    ```

    If you have the Blaxel CLI `bl` installed, you can use it to directly interpolate your API key into the HTTP request, as shown below:

    ```http theme={null}
    curl -X POST "https://run.blaxel.ai/$(bl workspace --current)/models/{your-model}/chat/completions" \
    -H "Content-Type: application/json" \
    -H "X-Blaxel-Authorization: Bearer $(bl token)" \
    -d '{"messages":[{"role":"user","content":"Hello!"}]}'
    ```
  </Tab>

  <Tab title="Execute a job">
    ```http theme={null}
    curl -X POST "https://api.blaxel.ai/{your-workspace}/jobs/{your-job-name}/executions" \
    -H "X-Blaxel-Authorization: Bearer <YOUR_API_KEY>" \
    -d '{"tasks":[{"my_arg":"my_value"}]}'
    ```

    If you have the Blaxel CLI `bl` installed, you can use it to directly interpolate your API key into the HTTP request, as shown below:

    ```http theme={null}
    curl -X POST "https://api.blaxel.ai/$(bl workspace --current)/jobs/{your-job-name}/executions" \
    -H "X-Blaxel-Authorization: Bearer $(bl token)" \
    -d '{"tasks":[{"my_arg":"my_value"}]}'
    ```
  </Tab>
</Tabs>

### Connect to MCP servers

**MCP servers** ([Model Context Protocol](https://github.com/modelcontextprotocol)) provide a toolkit of multiple capabilities for agents. These servers can be interacted with using Blaxel's streamable HTTP transport implementation on the server's global endpoint.

<Card title="Connect to an MCP server" icon="bolt" href="/Functions/Invoke-functions">
  Learn how to run tool calls through your MCP server.
</Card>

### Manage sessions

To simulate multi-turn conversations, you can pass on request headers. You'll need your client to generate this ID and pass it using any header which you can retrieve via the code (e.g. `Thread-Id`). Without a thread ID, the agent won't maintain nor use any conversation memory when processing the request.

This is only available for agent requests.

```http Query agent with thread ID theme={null}

curl -X POST "https://run.blaxel.ai/{your-workspace}/agents/{your-agent}" \
-H 'Content-Type: application/json' \
-H "X-Blaxel-Authorization: Bearer <YOUR_API_KEY>" \
-H "X-Blaxel-Thread-Id: <THREAD_ID>" \
-d '{"inputs":"Hello, world!"}'

```

<Card title="Product documentation" icon="earth-americas" href="/Agents/Query-agents"> Read our product guide on querying an agent. </Card>
