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
- The endpoint usually needs to include
/v1. - The API key should come from your own API Tokens page.
- 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 with | Related docs |
|---|---|---|
| Confirm that the account can fetch models | List models | API Access |
| Make the most common chat request | Chat completions | Chat APIs |
| Use the Responses API | Responses API | Common Endpoints |
| Build embeddings for search or knowledge-base flows | Embeddings | Common Endpoints |
| Generate images | Image generation | AI Apps / API Access |
Example conventions
- Replace
sk-your-api-keywith your real API key. - Replace the
modelvalue 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"
}'