Skip to content

Register a model

Instead of embedding model configuration in every agent, register a model once and reference it by model_ref. This makes credential rotation and model upgrades easier across many agents.

  1. Create a model registration JSON file.

    {
    "model_id": "gpt-4o-mini",
    "provider_id": "openai",
    "params": {
    "model": "gpt-4o-mini",
    "temperature": 0.0,
    "api_key": { "$secretRef": "RESPONSE_PROVIDER_API_KEY" }
    }
    }
  2. Add it to an agentspace.

    Terminal window
    alquimia registry models add gpt-4o-mini.json --namespace default
  3. Verify the registration.

    Terminal window
    alquimia registry models list --namespace default
from alquimia.core.registry import Registry
from alquimia.core.models import ModelRegistration
registry = Registry(registry_dir="/var/lib/alquimia/registry")
registry.add_model(
"default",
ModelRegistration(
model_id="gpt-4o-mini",
provider_id="openai",
params={
"model": "gpt-4o-mini",
"temperature": 0.0,
"api_key": {"$secretRef": "RESPONSE_PROVIDER_API_KEY"},
},
),
)
{
"assistant_id": "support-bot",
"response": {
"provider_id": "alquimia",
"config": {
"model_ref": "gpt-4o-mini"
},
"profile": {
"system_prompt": "You are a helpful support assistant.",
"evaluation_strategy": { "evaluation_strategy_id": "one-shoot" }
}
}
}

Per-use params override the registered defaults:

{
"response": {
"provider_id": "alquimia",
"config": {
"model_ref": "gpt-4o-mini",
"params": {
"temperature": 0.7,
"max_tokens": 2048
}
},
"profile": { ... }
}
}
{
"shields": {
"intent-classifier": {
"provider_id": "shield-config",
"connector": {
"provider_id": "alquimia",
"profile": {
"system_prompt": "Classify user intent.",
"evaluation_strategy": {
"evaluation_strategy_id": "one-shoot",
"structured_output": {
"method": "json_schema",
"json_schema": {
"type": "object",
"properties": { "intent": { "type": "string" } },
"required": ["intent"]
}
}
}
},
"config": { "model_ref": "gpt-4o-mini" }
},
"action": "observe"
}
}
}
ProviderTypical params
openaimodel, api_key, base_url, temperature, max_tokens
groqmodel, groq_api_key, temperature, max_tokens
huggingfacemodel, api_key, base_url, temperature, max_tokens
ollamamodel, base_url, temperature, max_tokens

See the Agent specification reference for the model_ref schema.