---
title: "Model and tools"
description: "Provider-neutral messages, models, tool definitions, and structured output."
---

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

# Model and tools

`cortavyn-model-api` defines portable messages, requests, responses, streaming events, tool calls, and structured output. Provider modules translate these contracts to each remote protocol; they never execute your tools.

Use `ChatModel` for completions, `StreamingChatModel` when incremental events matter, and `StructuredChatModel` to request a Java record from a model. Tool definitions describe what a model may call, while application-owned executors perform the work.

```java
record Weather(String city, int temperature) { }

Weather answer = model.withStructuredOutput(Weather.class)
    .complete(request)
    .toCompletableFuture()
    .join()
    .value();
```

See [Providers](/providers/overview) for adapter selection and [Chat](/chat/tools) for tools in an agent loop.

Source: https://docs.cortavyn.org/concepts/model-and-tools/index.mdx
