Skip to content

First test with an LLM model

This guide lets you verify access to LLM models served by ALIDA before configuring an agent. The service uses Ollama and provides both native APIs and OpenAI-compatible endpoints.

Choose the endpoint

Two access modes are available:

  • ALIDA gateway: https://<alida-instance-url>/events/ollama/ollama-user. This is the recommended option for applications operating in ALIDA. For example, use https://alida.devng.alidalab.it/events/ollama/ollama-user for the devng instance. The gateway requires an API key created in the ALIDA user interface and sent as Authorization: Apikey <api-key>. The procedure is described in the API keys guide.

Warning

To create an API key for use with agents, you must have the ollama-user role in ALIDA. Contact an administrator to request access.

  • Development instance: https://ollama.develop.alidalab.it. Use it only if you have authorized credentials for direct access. The development instance instead requires the Authorization: Basic <base64-credentials> header.

Warning

An API key for the development instance cannot be generated automatically; contact an administrator to request it.

Calls to the models are standard HTTP endpoints.

Set the variables

export ALIDA_URL='https://<alida-instance-url>'
export ALIDA_API_KEY='<api-key-generated-in-the-alida-ui>'
export OLLAMA_DEVELOP_URL='https://ollama.develop.alidalab.it'
export OLLAMA_DEVELOP_BASIC_AUTH='<base64-encoded-basic-credentials>'

List the models

Before sending a request, retrieve the catalog and choose a value to use in place of <model>.

curl -sS \
  "${ALIDA_URL}/events/ollama/ollama-user/api/tags" \
  -H "Authorization: Apikey ${ALIDA_API_KEY}"
curl -sS \
  "${ALIDA_URL}/events/ollama/ollama-user/v1/models" \
  -H "Authorization: Apikey ${ALIDA_API_KEY}"
curl -sS "${OLLAMA_DEVELOP_URL}/api/tags" \
  -H "Authorization: Basic ${OLLAMA_DEVELOP_BASIC_AUTH}"
curl -sS "${OLLAMA_DEVELOP_URL}/v1/models" \
  -H "Authorization: Basic ${OLLAMA_DEVELOP_BASIC_AUTH}"

Generate a first response

The "stream": false parameter returns a single JSON response, which is useful for an initial test.

curl -sS \
  "${ALIDA_URL}/events/ollama/ollama-user/api/generate" \
  -H "Authorization: Apikey ${ALIDA_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "<model>",
    "prompt": "Hello world",
    "stream": false
  }'
curl -sS \
  "${ALIDA_URL}/events/ollama/ollama-user/v1/chat/completions" \
  -H "Authorization: Apikey ${ALIDA_API_KEY}" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "<model>",
    "messages": [
      {"role": "user", "content": "Hello world"}
    ],
    "stream": false
  }'
curl -sS "${OLLAMA_DEVELOP_URL}/api/generate" \
  -H "Authorization: Basic ${OLLAMA_DEVELOP_BASIC_AUTH}" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "<model>",
    "prompt": "Hello world",
    "stream": false
  }'
curl -sS "${OLLAMA_DEVELOP_URL}/v1/chat/completions" \
  -H "Authorization: Basic ${OLLAMA_DEVELOP_BASIC_AUTH}" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "<model>",
    "messages": [
      {"role": "user", "content": "Hello world"}
    ],
    "stream": false
  }'

After verifying the model, choose and prepare an OpenCode agent or an ADK agent. Configure chat only after the agent has been deployed and started.