Call the Genesis API

After completing this page, you will get a model ID and receive a text response through Chat Completions. For the full list of endpoints and request details, see Genesis.

1. Configure the service address and credential

Prepare the Genesis API base URL and either a personal access token or service-account API key with Genesis access:

export GENESIS_BASE_URL='https://token.moi.matrixorigin.cn/v1'
export GENESIS_ACCESS_TOKEN='<your-access-token>'

2. Get a model ID

Open a model in the Genesis model marketplace and copy its model ID. You can also use the following API to list the models available to the current credential:

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>'

3. Call example

This example uses Chat Completions and the credential and model ID from the previous steps to 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