LiteLLM API - Documentation✯
The LiteLLM API allows you to interact with large language models (LLM) from your tools or IDE. It simplifies integration with various providers (OpenAI, Ollama, etc.).
Base URL: https://api.ia.limos.fr
API Key Management✯
You can create an API key in your ia.limos.fr space → "My keys" tab.
For interns, generate a temporary key valid for 30 days (renewable). This key is linked to your account and can be deleted at any time.
Basic Configuration✯
For services using an LLM (e.g., chatbots, AI assistants), specify:
- URL: https://api.ia.limos.fr/v1
- API Key: the one generated on ia.limos.fr
Basic Commands✯
List available models✯
Bash
curl -X GET "https://api.ia.limos.fr/v1/models" -H "Authorization: Bearer API_KEY"
Python
import requests
headers = {
"Authorization": "Bearer API_KEY" # Replace with your key
}
response = requests.get("https://api.ia.limos.fr/v1/models", headers=headers)
print(response.json())
Query for chat completion✯
Bash
curl -X POST "https://api.ia.limos.fr/v1/chat/completions" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "general_nothink",
"messages": [
{"role": "system", "content": "You are a clear and concise assistant."},
{"role": "user", "content": "Tell me the capital of France."}
],
"max_tokens": 50,
"temperature": 0.7
}'
Python
import requests
import json
data = {
"model": "general_nothink",
"messages": [
{"role": "system", "content": "You are a clear and concise assistant."},
{"role": "user", "content": "Tell me the capital of France."}
],
"max_tokens": 50,
"temperature": 0.7
}
headers = {
"Authorization": "Bearer API_KEY", # Replace with your key
"Content-Type": "application/json"
}
response = requests.post(
"https://api.ia.limos.fr/v1/chat/completions",
headers=headers,
data=json.dumps(data)
)
print(response.json())
Query for an embedding (vector representation of text)✯
Bash
curl -X POST "https://api.ia.limos.fr/v1/embeddings" \
-H "Authorization: Bearer API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "embedding",
"input": "Hello, how are you?"
}'
Python
import requests
import json
data = {
"model": "embedding-model",
"input": "Hello, how are you?"
}
headers = {
"Authorization": "Bearer API_KEY", # Replace with your key
"Content-Type": "application/json"
}
response = requests.post(
"https://api.ia.limos.fr/v1/embeddings",
headers=headers,
data=json.dumps(data)
)
print(response.json())
Additional Notes✯
- Required headers:
Authorization: Bearer <your_key>Content-Type: application/json(for POST requests).- Adjustable parameters:
temperature(0.0 to 1.0): controls the randomness of responses.max_tokens: limits the length of the response.