Tham số đường dẫn
Tên mô hình (ví dụ:
gemini-2.5-pro, gemini-2.5-flash).For production integrations, prefer URL-based fileData / file_data media parts with a public https URL.
LemonData will route supported Gemini-native channels through the native path when possible and automatically fall back to the compatible internal conversion path when a native-ready route is unavailable for that multimodal request.Tham số truy vấn
API key (phương thức thay thế cho xác thực qua header).
Xác thực
Các endpoint của Gemini hỗ trợ nhiều phương thức xác thực:?key=YOUR_API_KEYtham số truy vấnx-goog-api-key: YOUR_API_KEYheaderAuthorization: Bearer YOUR_API_KEYheader
Thân yêu cầu
Nội dung cuộc hội thoại.Mỗi đối tượng nội dung bao gồm:
role(string):userhoặcmodelparts(array): các part nội dung. LemonData hiện hỗ trợ:- part văn bản:
{ "text": "..." } - part media inline:
inlineData/inline_data - part tệp dựa trên URL:
fileData/file_data
- part văn bản:
Chỉ dẫn hệ thống cho mô hình.
Cấu hình tạo nội dung:
temperature(number): Nhiệt độ lấy mẫu (sampling temperature)topP(number): Xác suất lấy mẫu hạt (nucleus sampling)topK(integer): Lấy mẫu Top-KmaxOutputTokens(integer): Số lượng token đầu ra tối đastopSequences(array): Các chuỗi dừng (stop sequences)
Cài đặt bộ lọc an toàn.
Phản hồi
Các ứng viên nội dung được tạo.
Thông tin sử dụng token.
Ví dụ đầu vào đa phương thức
Với các yêu cầu Gemini đa phương thức, hãy đặt media vàocontents[].parts[] bằng byte inline hoặc tham chiếu tệp dựa trên URL.
Các loại media hiện được hỗ trợ trong public contract Gemini:
- image
- audio
- video
inlineData hoặc inline_data và truyền byte tệp được mã hoá Base64.
Với media qua URL, dùng fileData hoặc file_data và truyền một URL công khai https.