---
title: LanguageModel
framework: foundationmodels
role: symbol
role_heading: Protocol
path: foundationmodels/languagemodel
---

# LanguageModel

A protocol that you use to interface with a model.

## Declaration

```swift
protocol LanguageModel : Sendable
```

## Mentioned in

Adding server-side intelligence with Private Cloud Compute

## Overview

Overview Implement this protocol to create a bridge between a model and the framework. The protocol describes the capabilities and the configuration for your model. An Executor does the work of translating framework types into the types your platform expects, and streams results back through LanguageModelExecutorGenerationChannel. Because most of the work is done in the executor, keep the type that adopts this protocol intentionally light. When your implementation is ready to adopt, distribute your solution with Swift Package Manager so developers can easily integrate it into their project. After they add your package, they simply initialize a LanguageModelSession with your model: // Initialize a session with a custom server model. let session = LanguageModelSession(model: MyCustomServerLanguageModel()) // Use the same API surface to prompt the model. let response = try await session.respond(to: "Tell me a joke!")

## Topics

### Inspecting model capabilities

- [capabilities](foundationmodels/languagemodel/capabilities.md)

### Getting the executor configuration

- [executorConfiguration](foundationmodels/languagemodel/executorconfiguration.md)
- [Executor](foundationmodels/languagemodel/executor.md)

## Relationships

### Inherits From

- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

### Conforming Types

- [PrivateCloudComputeLanguageModel](foundationmodels/privatecloudcomputelanguagemodel.md)
- [SystemLanguageModel](foundationmodels/systemlanguagemodel.md)

## See Also

### Custom language model provider

- [Optimizing key-value caching in language model sessions](foundationmodels/optimizing-key-value-caching-in-language-model-sessions.md)
- [LanguageModelCapabilities](foundationmodels/languagemodelcapabilities.md)
- [LanguageModelExecutor](foundationmodels/languagemodelexecutor.md)
- [LanguageModelExecutorGenerationChannel](foundationmodels/languagemodelexecutorgenerationchannel.md)
- [LanguageModelExecutorGenerationRequest](foundationmodels/languagemodelexecutorgenerationrequest.md)
