models = aimodels()
models = aimodels(options)
[models, response] = aimodels(options)
aimodels returns the available model names for a configured AI provider.
For Ollama, aimodels calls the local /api/tags endpoint derived from the endpoint stored in options. The default endpoint is http://127.0.0.1:11434/api/tags.
For OpenAI-compatible providers, aimodels calls /v1/models derived from the configured endpoint and uses TokenEnvVar as a bearer token when provided.
The first output is a cell array of model names. The optional second output is the raw provider response.
models = aimodels()
models = aimodels();
opts = aioptions('Provider', 'ollama', ...
'Model', models{1}, ...
'SystemPrompt', 'Return only Nelson code. Nelson functions use syntax: function y = name(x), statements, end.', ...
'Think', false, ...
'NumPredict', 120, ...
'Temperature', 0);
answer = aiask('Write function y = vector_mean(x). Use y = mean(x).', opts)
opts = aioptions('Provider', 'ollama', ...
'Model', 'gemma4:latest', ...
'SystemPrompt', 'Return only Nelson code. Nelson functions use syntax: function y = name(x), statements, end.', ...
'Think', false, ...
'NumPredict', 120, ...
'Temperature', 0);
answer = aiask('Write function y = vector_mean(x). Use y = mean(x).', opts)
opts = aioptions('Provider', 'openai-compatible', ...
'Endpoint', 'http://127.0.0.1:8000/v1/chat/completions', ...
'Timeout', 30);
models = aimodels(opts)
% Define MY_AI_TOKEN in the environment before starting Nelson.
opts = aioptions('Provider', 'openai-compatible', ...
'Endpoint', 'https://example.local/v1/chat/completions', ...
'TokenEnvVar', 'MY_AI_TOKEN', ...
'Timeout', 30);
models = aimodels(opts)
| Version | Description |
|---|---|
| 2.0.0 | initial version |