/v1beta/models/* — Native Google Gemini API format
Endpoints
POST /v1/models/{model}:{action}
POST /v1beta/models/{model}:{action}
GET /v1/models
GET /v1beta/models
Overview
These endpoints accept the native Google Gemini API format. Use this if you're using the Google AI SDK or need Gemini-specific features.
Authentication
x-goog-api-key: YOUR_API_KEY
# or as query parameter:
?key=YOUR_API_KEY
Example — generateContent
cURL
curl "https://api.nbility.dev/v1beta/models/gemini-2.0-flash:generateContent?key=YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{
"role": "user",
"parts": [{"text": "What is the capital of Japan?"}]
}
]
}'
Python
import google.generativeai as genai
genai.configure(
api_key="YOUR_API_KEY",
transport="rest",
client_options={"api_endpoint": "https://api.nbility.dev"}
)
model = genai.GenerativeModel("gemini-2.0-flash")
response = model.generate_content("What is the capital of Japan?")
print(response.text)
Request Body
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
contents | array | yes | Array of content objects (role + parts) | |
systemInstruction | object | no | System instruction content object | |
generationConfig | object | no | Generation parameters (temperature, maxOutputTokens, etc.) | |
safetySettings | array | no | Safety filter settings | |
tools | array | no | Tool definitions for function calling |
Actions
| Action | Description |
|---|---|
generateContent | Standard content generation |
streamGenerateContent | Streaming generation (SSE) |
embedContent | Generate embeddings |
countTokens | Count tokens |
Response
{
"candidates": [
{
"content": {
"parts": [{"text": "The capital of Japan is Tokyo."}],
"role": "model"
},
"finishReason": "STOP",
"index": 0
}
],
"usageMetadata": {
"promptTokenCount": 8,
"candidatesTokenCount": 7,
"totalTokenCount": 15
}
}
Note You can also use Gemini models via the standard
/v1/chat/completionsendpoint withAuthorization: Bearer— no format conversion needed.