Skip to content

API Examples

This page collects the most common request examples. The official default API is https://api.dli.li/v1, and the official backup API is https://api.dlizz.com/v1. If you are using your own self-hosted or third-party compatible endpoint, replace the address in the examples with your actual endpoint.

API recommendation

Use the official default API `https://api.dli.li/v1`, or use the official backup API `https://api.dlizz.com/v1` directly.

Check these first

  1. The endpoint usually needs to include /v1.
  2. The API key should come from your own API Tokens page.
  3. The model name should match one of the models currently available to your account.

Choose an example by scenario

What do you want to do?Example to start withRelated docs
Confirm that the account can fetch modelsList modelsAPI Access
Make the most common chat requestChat completionsChat APIs
Use the Responses APIResponses APICommon Endpoints
Build embeddings for search or knowledge-base flowsEmbeddingsCommon Endpoints
Generate imagesImage generationAI Apps / API Access

Example conventions

  • Replace sk-your-api-key with your real API key.
  • Replace the model value with a model that is actually available to your account.
  • If you use a self-hosted or third-party compatible endpoint, replace the domain in the examples with your real endpoint.

List models

bash
curl https://api.dli.li/v1/models   -H "Authorization: Bearer sk-your-api-key"

Chat completions

bash
curl https://api.dli.li/v1/chat/completions   -H "Content-Type: application/json"   -H "Authorization: Bearer sk-your-api-key"   -d '{
    "model": "gpt-4o-mini",
    "messages": [
      { "role": "user", "content": "Introduce yourself in three short sentences." }
    ]
  }'

Responses API

bash
curl https://api.dli.li/v1/responses   -H "Content-Type: application/json"   -H "Authorization: Bearer sk-your-api-key"   -d '{
    "model": "gpt-4.1-mini",
    "input": "Write a short welcome message."
  }'

Embeddings

bash
curl https://api.dli.li/v1/embeddings   -H "Content-Type: application/json"   -H "Authorization: Bearer sk-your-api-key"   -d '{
    "model": "text-embedding-3-small",
    "input": "Dli.li is an AI relay platform."
  }'

Image generation

bash
curl https://api.dli.li/v1/images/generations   -H "Content-Type: application/json"   -H "Authorization: Bearer sk-your-api-key"   -d '{
    "model": "gpt-image-1",
    "prompt": "A cat standing on clouds in a futuristic illustration style"
  }'