AgentsModel and provider
AGENTS

Model and provider

Connect an agent to a model and keep credentials in application configuration.

This page covers model-provider execution, selected through the model: constructor argument or UseModel(...). The provider/model string selects the provider and model. Configure the connection before testing a response.

Local CLI agents use different configuration: Codex CLI and Claude CLI require an explicit CLI model in their configuration callbacks. See the Claude guide for callback API availability. Both use the host account's CLI authentication rather than an agent apiKey argument. The provider registry and generation defaults below apply to model execution.

Configure your first connection

For local development, initialize user secrets in the ASP.NET Core project:

.NET CLI
dotnet user-secrets init
dotnet user-secrets set "OpenAI:ApiKey" "YOUR_API_KEY"

Use the key from configuration when creating the agent:

C#
using Runiq.AI.Agents;

var agent = new Agent(
    id: "support-agent",
    name: "Support Agent",
    instructions: "Help users understand the application. State uncertainty clearly.",
    model: "openai/gpt-5",
    apiKey: builder.Configuration["OpenAI:ApiKey"]);

Place this after creating builder and register the definition with options.AddAgent(agent). The model is an example; use one available in your provider account. User secrets are for development; use your deployment's secret configuration in production.

Understand the model reference

In openai/gpt-5, openai selects the provider strategy and gpt-5 is passed to its client. Runiq validates the provider name, but model availability and supported parameters depend on the provider.

For a locally running Ollama server, use a model you have installed:

YAML
model: "ollama/llama3.2"

The default Ollama connection does not require an API key.

Provider reference

These are the defaults defined by Runiq's provider registry.

ProviderDefault URLKey required at default URL
openaihttps://api.openai.com/v1Yes
ollamahttp://localhost:11434No
groqhttps://api.groq.com/openai/v1Yes
mistralhttps://api.mistral.ai/v1Yes
deepseekhttps://api.deepseek.comYes
openrouterhttps://openrouter.ai/api/v1Yes
togetherhttps://api.together.xyz/v1Yes
fireworkshttps://api.fireworks.ai/inference/v1Yes
nvidiahttps://integrate.api.nvidia.com/v1Yes
azure-openaiConfigure an explicit URLYes

Override connection options

ProviderOptions belongs to Runiq.AI.Core.Configuration. Pass it as the agent's provider argument:

C#
using Runiq.AI.Core.Configuration;

var provider = new ProviderOptions
{
    Url = "https://api.openai.com/v1",
    Timeout = TimeSpan.FromSeconds(60)
};

Url overrides the default endpoint. Timeout handling depends on the provider client implementation; the option should not be treated as a universal deadline. Pass a cancellation token when running the agent.

Tune response behavior

Constructor argumentAccepted valuesDefault
reasoningEffortminimal, low, medium, highminimal
verbositylow, medium, highlow

These are Runiq's accepted configuration values. Their effect depends on the selected provider and model; they do not guarantee identical behavior across providers.

Check connection failures

If execution reports ApiKeyMissing, confirm the key is present in the running host's configuration. For rejected model requests, check the model identifier, endpoint, credentials, and provider response.

Next: Run the registered agent →

On this page