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

# Providers and Models

> Configure backend access separately from model selection.

Superwire separates provider instances and model profiles.

```text theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
provider instance -> model profile -> agent
```

## Provider declarations

A provider declaration creates a named provider instance.

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
secrets {
    api_key: string
}

provider llm from openai {
    endpoint: "https://api.openai.com/v1"
    api_key: secrets.api_key
}
```

`openai` is the provider type. `llm` is the provider instance name.

At the moment, the executor supports OpenAI-compatible providers through the `/responses` API.

## Model declarations

A model declaration creates a reusable model profile from a provider instance.

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
model fast from llm {
    id: "gpt-4.1-mini"
}
```

The `id` is the provider-specific model identifier sent to the configured provider.

Models that accept non-text inputs should declare those supported asset kinds:

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
model vision from llm {
    id: "qwen-plus"
    assets: ["image", "video"]
}
```

The supported asset kinds are `image`, `video`, and `document`. Superwire validates `asset` usage against this list before sending a model request.

Agents reference model profiles through the `model` namespace:

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
agent reply {
    model: model.fast
    instruction: "Reply to {{ input.message }}"

    output {
        message: string
    }
}
```

## Inference defaults

Inference configuration belongs on the model profile when it should apply to every agent using that profile.

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
model fast from llm {
    id: "gpt-4.1-mini"

    inference {
        temperature: 0.2
        max_tokens: 4_000
    }
}
```

An agent can override inference for that specific model usage by opening a block after the model reference:

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
agent creative_reply {
    model: model.fast {
        inference {
            temperature: 0.8
        }
    }

    instruction: "Write a creative reply to {{ input.message }}"

    output {
        message: string
    }
}
```

The usage block specializes the model for that agent. It does not create a new named model profile.

## Multiple model profiles

Define multiple profiles when different agents should use different model IDs or inference defaults.

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
model fast from llm {
    id: "gpt-4.1-mini"
}

model smart from llm {
    id: "gpt-4.1"
}

model cheap from llm {
    id: "gpt-4.1-nano"
}
```

Then each agent chooses the profile that matches its job:

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
agent quick_reply {
    model: model.fast
    instruction: "Reply briefly to {{ input.message }}"

    output {
        message: string
    }
}

agent careful_review {
    model: model.smart
    instruction: "Review this carefully: {{ input.message }}"

    output {
        review: string
    }
}
```

## Provider-level defaults

Provider-level defaults are optional and should be reserved for settings that truly apply to all model calls through that provider, such as timeout or retry configuration.

```wire theme={"languages":{"custom":["/languages/wire.tmLanguage.json"]}}
provider llm from openai {
    endpoint: "https://api.openai.com/v1"
    api_key: secrets.api_key

    inference {
        timeout_seconds: 60
        retry_attempts: 2
    }
}
```
