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

# Deepline Agent: Ai Inference

> Managed LLM inference: run a prompt against any modern model to classify, score, summarize, extract or write text, with optional JSON output.

Managed LLM inference: run a prompt against any modern model to classify, score, summarize, extract or write text, with optional JSON output.

> [!NOTE]
>
> Tool ID: `ai_inference`

## Run this action

Use the TypeScript SDK for one call. Use `ctx.tools.execute(...)` inside a Play for durable calls, scheduled calls, or CSV processing.

```ts theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'ai_inference',
  {
    "prompt": "example",
    "messages": [
      {
        "role": "system",
        "content": "Example message"
      }
    ],
    "model": "openai/gpt-5.6-luna"
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline tools execute ai_inference --input '{
  "prompt": "example",
  "messages": [
    {
      "role": "system",
      "content": "Example message"
    }
  ],
  "model": "openai/gpt-5.6-luna"
}' --json
```

## Example response

The SDK returns this shape at `result.toolResponse.raw`. The example values illustrate the response.

```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
{
  "status": "completed",
  "result": {
    "text": "example",
    "finishReason": "example"
  },
  "usage": {
    "inputTokens": 123,
    "outputTokens": 123,
    "totalTokens": 123
  },
  "output": "example",
  "extracted_json": {}
}
```

Use `deepline describe ai_inference --json` for the latest machine-readable contract.

## Input reference

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.prompt` | `string` | No | — | — |
| `payload.messages` | `array` | No | — | — |
| `payload.model` | `string` | No | `"openai/gpt-5.6-luna"` | Exact, case-sensitive provider/model ID from the live Vercel AI Gateway language-model catalog. Examples: "openai/gpt-5.6-luna". See [https://ai-gateway.vercel.sh/v1/models](https://ai-gateway.vercel.sh/v1/models) for accepted IDs. availability can change. Pattern: `^[a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._-]*$`. |
| `payload.system` | `string` | No | — | Optional system prompt. |
| `payload.jsonSchema` | `object \| string \| unknown` | No | — | Optional JSON Schema for the structured result, a strict subset: the root is type "object". supported keywords are type, properties, required, items, enum, uniqueItems, description and additionalProperties. types are string, number, integer, boolean, null, object and array. Every field is returned: omit required (every property becomes required) or list every property, and make a field optional with a nullable type such as \["string","null"]. |
| `payload.providerOptions` | `record` | No | — | AI SDK providerOptions passthrough, namespaced by provider. Examples: \{"gateway":\{"serviceTier":"priority"},"openai":\{"reasoningEffort":"low"}}. |
| `payload.serviceTier` | `"flex" \| "priority"` | No | — | Convenience alias for providerOptions.gateway.serviceTier when no explicit gateway serviceTier is provided. Allowed: `flex`, `priority`. |
| `payload.maxOutputTokens` | `integer` | No | — | Maximum output tokens for each model call. For reasoning models this budget includes reasoning and response tokens, so structured output needs enough headroom to complete. Minimum: 16. |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "",
    "properties": {
      "prompt": {
        "type": "string",
        "allowsTemplatePlaceholders": true
      },
      "messages": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "role": {
              "type": "string",
              "enum": [
                "system",
                "user",
                "assistant"
              ]
            },
            "content": {
              "type": "string",
              "allowsTemplatePlaceholders": true
            }
          },
          "required": [
            "role",
            "content"
          ],
          "additionalProperties": false
        }
      },
      "model": {
        "type": "string",
        "description": "Exact, case-sensitive provider/model ID from the live Vercel AI Gateway language-model catalog. Examples: \"openai/gpt-5.6-luna\". See https://ai-gateway.vercel.sh/v1/models for accepted IDs; availability can change.",
        "default": "openai/gpt-5.6-luna",
        "pattern": "^[a-z0-9][a-z0-9._-]*/[a-z0-9][a-z0-9._-]*$",
        "feature": "ai_gateway_model"
      },
      "system": {
        "type": "string",
        "description": "Optional system prompt.",
        "allowsTemplatePlaceholders": true
      },
      "jsonSchema": {
        "description": "Optional JSON Schema for the structured result, a strict subset: the root is type \"object\"; supported keywords are type, properties, required, items, enum, uniqueItems, description and additionalProperties; types are string, number, integer, boolean, null, object and array. Every field is returned: omit required (every property becomes required) or list every property, and make a field optional with a nullable type such as [\"string\",\"null\"].",
        "anyOf": [
          {
            "type": "object",
            "description": "A JSON Schema object.",
            "properties": {
              "type": {
                "type": "string",
                "const": "object"
              },
              "properties": {
                "type": "object",
                "description": "Field name to its schema: {\"type\": ...}, plus properties and required for a nested object, or items for an array.",
                "additionalProperties": {}
              },
              "required": {
                "description": "Property names. Omit to require every property, or list every property name."
              },
              "additionalProperties": {
                "type": "boolean",
                "description": "Defaults to false."
              },
              "description": {
                "type": "string"
              }
            },
            "required": [
              "type"
            ],
            "additionalProperties": false
          },
          {
            "type": "string",
            "description": "The same schema as a JSON string."
          },
          {}
        ]
      },
      "providerOptions": {
        "type": "object",
        "description": "AI SDK providerOptions passthrough, namespaced by provider. Examples: {\"gateway\":{\"serviceTier\":\"priority\"},\"openai\":{\"reasoningEffort\":\"low\"}}.",
        "additionalProperties": {}
      },
      "serviceTier": {
        "type": "string",
        "description": "Convenience alias for providerOptions.gateway.serviceTier when no explicit gateway serviceTier is provided.",
        "enum": [
          "flex",
          "priority"
        ]
      },
      "maxOutputTokens": {
        "type": "integer",
        "description": "Maximum output tokens for each model call. For reasoning models this budget includes reasoning and response tokens, so structured output needs enough headroom to complete.",
        "minimum": 16
      }
    },
    "additionalProperties": false
  }
  ```
</details>

## Output reference

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.status` | `"completed"` | Yes | — | — |
| `result.result` | `object` | Yes | — | — |
| `result.result.text` | `string` | Yes | — | — |
| `result.result.object` | `record` | No | — | — |
| `result.result.finishReason` | `string \| null` | Yes | — | — |
| `result.usage` | `object` | Yes | — | — |
| `result.usage.inputTokens` | `integer` | Yes | — | — |
| `result.usage.outputTokens` | `integer` | Yes | — | — |
| `result.usage.totalTokens` | `integer` | Yes | — | — |
| `result.meta` | `object` | No | — | — |
| `result.meta.model` | `string` | Yes | — | — |
| `result.meta.totalCostUsd` | `number` | No | — | — |
| `result.meta.jsonSchema` | `unknown \| null` | No | — | — |
| `result.output` | `string` | Yes | — | — |
| `result.extracted_json` | `record \| array \| null` | Yes | — | — |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "properties": {
      "status": {
        "type": "string",
        "const": "completed"
      },
      "result": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          },
          "object": {
            "type": "object",
            "additionalProperties": {}
          },
          "finishReason": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "text",
          "finishReason"
        ],
        "additionalProperties": false
      },
      "usage": {
        "type": "object",
        "properties": {
          "inputTokens": {
            "type": "integer"
          },
          "outputTokens": {
            "type": "integer"
          },
          "totalTokens": {
            "type": "integer"
          }
        },
        "required": [
          "inputTokens",
          "outputTokens",
          "totalTokens"
        ],
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string"
          },
          "totalCostUsd": {
            "type": "number"
          },
          "jsonSchema": {
            "anyOf": [
              {},
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "model"
        ],
        "additionalProperties": false
      },
      "output": {
        "type": "string"
      },
      "extracted_json": {
        "anyOf": [
          {
            "type": "object",
            "additionalProperties": {}
          },
          {
            "type": "array",
            "items": {}
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "required": [
      "status",
      "result",
      "usage",
      "output",
      "extracted_json"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `provider_usage` (provider usage).
* Estimated Deepline credits: `0` per pricing unit.

## Related documentation

* [Deepline Agent provider guide](https://deepline.com/docs/providers/deeplineagent/guide.md)
* [SDK V2 quickstart](https://deepline.com/docs/sdk-v2/quickstart.md)
* [SDK reference](https://deepline.com/docs/sdk-v2/sdk-reference.md)
* [Run tools across a CSV](https://deepline.com/docs/sdk-v2/batch-csv.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.