Call the API

After completing this page, you will list the models available to your credentials and receive a text response through Chat Completions. For the full list of endpoints and request details, see Genesis.

Prepare connection details

Prepare the complete Genesis API base URL supplied by the current environment, and either a personal access token or service-account API key with Genesis access:

export GENESIS_BASE_URL='<Complete Genesis Base URL copied from the console>'
export GENESIS_ACCESS_TOKEN='<your-access-token>'

The base URL usually already includes the version path. Keep the value supplied by the current environment unchanged; do not append another version path or substitute another product’s service address.

Get a model ID

curl "$GENESIS_BASE_URL/models" \
  -H "Authorization: Bearer $GENESIS_ACCESS_TOKEN" \
  -H "Accept: application/json"

Select a model that supports text conversation from the response, and save its ID:

export MODEL_ID='<model-id-from-response>'

Send a message

curl -X POST "$GENESIS_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $GENESIS_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "'"$MODEL_ID"'",
    "messages": [
      {"role": "user", "content": "Explain data lineage in one sentence."}
    ],
    "max_tokens": 1024
  }'

Text content in the response confirms that the model returned a response. Save the request ID and actual model ID from the response to help investigate later calls.

Next steps

Last updated on