LLMoxy hỗ trợ nhiều định dạng yêu cầu. Ứng dụng hiện có thường chỉ cần thay thế URL cơ sở và Khóa API để di chuyển.
Tương thích OpenAI
Cấu hình SDK OpenAI:
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.LLMOXY_API_KEY,
baseURL: "https://llmoxy.com/v1",
});
Các tuyến chính:
| Tuyến | Mục đích |
|---|---|
POST /v1/chat/completions | Chat Completions。 |
POST /v1/completions | Bổ sung văn bản cũ。 |
POST /v1/responses | Responses API。 |
POST /v1/embeddings | Embeddings。 |
POST /v1/images/generations | Tạo hình ảnh。 |
POST /v1/audio/transcriptions | Phiên âm âm thanh。 |
POST /v1/audio/translations | Dịch âm thanh。 |
POST /v1/audio/speech | Chuyển văn bản thành giọng nói。 |
GET /v1/realtime | Realtime WebSocket。 |
Anthropic Messages
curl https://llmoxy.com/v1/messages \
-H "x-api-key: <LLMOXY_API_KEY>" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-3-5-sonnet-latest",
"max_tokens": 256,
"messages": [
{ "role": "user", "content": "Hello" }
]
}'
Các tuyến Anthropic chấp nhận system、max_tokens、temperature、top_p、top_k、stop_sequences、tools、tool_choice、thinking、metadata.user_id và các trường khác.
Gemini
curl "https://llmoxy.com/v1beta/models/gpt-5.4:generateContent" \
-H "x-goog-api-key: <LLMOXY_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [{ "text": "Explain LLMoxy in one sentence." }]
}
]
}'
Danh sách mô hình kiểu Gemini có thể sử dụng GET /v1beta/models.
Các tuyến tương thích chưa được triển khai
Hiện tại Relay trả về chưa triển khai đối với các tuyến tương thích OpenAI sau:
POST /v1/images/variations/v1/files/v1/fine-tunesDELETE /v1/models/{model}
