Проксирование запросов к LLM
POST /api/dataguard/public/{serviceName}/{proxyPath}
OpenAI
- cURL
- Python
export JAY_GUARD_BASE_URL="https://app.jayguard.com"
export DATA_GUARD_API_KEY="your_api_key_here"
export OPENAI_API_KEY="your_api_key_here"
curl -X POST "${JAY_GUARD_BASE_URL}/api/dataguard/public/openai/v1/chat/completions" \
-H "X-DATA-GUARD-API-KEY: ${DATA_GUARD_API_KEY}" \
-H "Authorization: Bearer ${OPENAI_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4o","messages": [{"role": "user","content": "Hello!"}]}'
import json
import httpx
JAY_GUARD_BASE_URL = "https://app.jayguard.com"
DATA_GUARD_API_KEY = "your_api_key_here"
OPENAI_API_KEY = "your_api_key_here"
client = httpx.Client()
response = client.post(
f"{JAY_GUARD_BASE_URL}/api/dataguard/public/openai/v1/chat/completions",
headers={
"X-DATA-GUARD-API-KEY": DATA_GUARD_API_KEY,
"Authorization": f"Bearer ${OPENAI_API_KEY}",
"Content-Type": "application/json"
},
json={"model": "gpt-4o", "messages": [{"role": "user", "content": "Hello!"}]}
)
print(json.dumps(response.json(), indent=2, ensure_ascii=False))
Claude через Caila
- cURL
- Python
export JAY_GUARD_BASE_URL="https://app.jayguard.com"
export DATA_GUARD_API_KEY="your_api_key_here"
export MLP_API_KEY="your_api_key_here" # API-токен из интерфейса Caila
export MLP_ACCOUNT="model_account_here" # "just-ai" для модели Claude
curl -X POST "${JAY_GUARD_BASE_URL}/api/dataguard/public/mlp/api/mlpgate/account/${MLP_ACCOUNT}/model/claude/predict-with-config" \
-H "X-DATA-GUARD-API-KEY: ${DATA_GUARD_API_KEY}" \
-H "MLP-API-KEY: ${MLP_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"data": {"messages": [{"role": "user","content": "Привет"}]},"config": {"model": "claude-3-5-sonnet"}}'
import json
import httpx
JAY_GUARD_BASE_URL = "https://app.jayguard.com"
DATA_GUARD_API_KEY = "your_api_key_here"
MLP_API_KEY = "your_api_key_here" # API-токен из интерфейса Caila
MLP_ACCOUNT = "model_account_here" # "just-ai"" для модели Claude
client = httpx.Client()
response = client.post(
f"{JAY_GUARD_BASE_URL}/api/dataguard/public/mlp/api/mlpgate/account/${MLP_ACCOUNT}/model/claude/predict-with-config",
headers={
"X-DATA-GUARD-API-KEY": DATA_GUARD_API_KEY,
"MLP-API-KEY": MLP_API_KEY,
"Content-Type": "application/json"
},
json={"data": {"messages": [{"role": "user", "content": "Привет"}]}, "config": {"model": "claude-3-5-sonnet"}}
)
print(json.dumps(response.json(), indent=2, ensure_ascii=False))
GigaChat
- cURL
- Python
export JAY_GUARD_BASE_URL="https://app.jayguard.com"
export DATA_GUARD_API_KEY="your_api_key_here"
export GIGACHAT_API_KEY="your_api_key_here"
curl -X POST "${JAY_GUARD_BASE_URL}/api/dataguard/public/gigachat/api/v1/chat/completions" \
-H "X-DATA-GUARD-API-KEY: ${DATA_GUARD_API_KEY}" \
-H "Authorization: Bearer ${GIGACHAT_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"model": "GigaChat:latest", "messages": [{"role": "user","content": "привет"}]}'
import json
import httpx
JAY_GUARD_BASE_URL = "https://app.jayguard.com"
DATA_GUARD_API_KEY = "your_api_key_here"
GIGACHAT_API_KEY = "your_api_key_here"
client = httpx.Client()
response = client.post(
f"{JAY_GUARD_BASE_URL}/api/dataguard/public/gigachat/api/v1/chat/completions",
headers={
"X-DATA-GUARD-API-KEY": DATA_GUARD_API_KEY,
"Authorization": f"Bearer ${GIGACHAT_API_KEY}",
"Content-Type": "application/json"
},
json={"model": "GigaChat:latest", "messages": [{"role": "user", "content": "привет"}]}
)
print(json.dumps(response.json(), indent=2, ensure_ascii=False))
YandexGPT
- cURL
- Python
export JAY_GUARD_BASE_URL="https://app.jayguard.com"
export DATA_GUARD_API_KEY="your_api_key_here"
export YANDEX_GPT_API_KEY="your_api_key_here"
curl -X POST "${JAY_GUARD_BASE_URL}/api/dataguard/public/yandexGpt/foundationModels/v1/completion" \
-H "X-DATA-GUARD-API-KEY: ${DATA_GUARD_API_KEY}" \
-H "Authorization: Api-Key ${YANDEX_GPT_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"messages": [{"role": "user","text": "Привет"}],"modelUri": "gpt://<YOUR_FOLDER_ID>/yandexgpt/latest"}'
import json
import httpx
JAY_GUARD_BASE_URL = "https://app.jayguard.com"
DATA_GUARD_API_KEY = "your_api_key_here"
YANDEX_GPT_API_KEY = "your_api_key_here"
client = httpx.Client()
response = client.post(
f"{JAY_GUARD_BASE_URL}/api/dataguard/public/yandexGpt/foundationModels/v1/completion",
headers={
"X-DATA-GUARD-API-KEY": DATA_GUARD_API_KEY,
"Authorization": f"Api-Key ${YANDEX_GPT_API_KEY}",
"Content-Type": "application/json"
},
json={"messages": [{"role": "user", "text": "Привет"}], "modelUri": "gpt://<YOUR_FOLDER_ID>/yandexgpt/latest"}
)
print(json.dumps(response.json(), indent=2, ensure_ascii=False))