Nbility logoNbility Docs

Search documentation

Search guides and API reference content

/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

NameTypeRequiredDefaultDescription
contentsarrayyesArray of content objects (role + parts)
systemInstructionobjectnoSystem instruction content object
generationConfigobjectnoGeneration parameters (temperature, maxOutputTokens, etc.)
safetySettingsarraynoSafety filter settings
toolsarraynoTool definitions for function calling

Actions

ActionDescription
generateContentStandard content generation
streamGenerateContentStreaming generation (SSE)
embedContentGenerate embeddings
countTokensCount 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/completions endpoint with Authorization: Bearer — no format conversion needed.