Nbility supports Gemini-style generateContent, streamGenerateContent, and model-list paths so existing Google Gen AI SDK and REST clients can migrate with minimal changes.
Endpoints
POST /v1beta/models/{model}:generateContent
POST /v1beta/models/{model}:streamGenerateContent
GET /v1beta/models
Use https://api.nbility.ai as the Base URL. Prefer the x-goog-api-key request header for authentication.
Python (Google Gen AI SDK)
Install the current SDK:
pip install -U google-genai
import os
from google import genai
from google.genai import types
client = genai.Client(
api_key=os.environ["NBILITY_API_KEY"],
http_options=types.HttpOptions(
base_url="https://api.nbility.ai",
api_version="v1beta",
),
)
response = client.models.generate_content(
model="YOUR_GEMINI_MODEL",
contents="Explain vector databases in one sentence.",
)
print(response.text)
Use google-genai for new applications. The older google-generativeai library is no longer the maintained SDK.
REST
curl "https://api.nbility.ai/v1beta/models/YOUR_GEMINI_MODEL:generateContent" \
-H "x-goog-api-key: $NBILITY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [{
"role": "user",
"parts": [{"text": "Explain API gateways briefly."}]
}]
}'
The compatible API also accepts ?key=, but the header is less likely to leak into logs.
Streaming
For streamGenerateContent, SDK users can consume the streaming iterator. REST clients should parse the stream format actually returned by the selected channel. SSE framing, tools, caching, multimodal input, and safety-field support can differ between providers.
If the selected model does not accept a native Gemini field, use the OpenAI-compatible endpoint or contact support to confirm channel capabilities.
Official references: Google Gen AI libraries ยท OpenAI compatibility