Gemini Text Chat (Native Format)
In addition to the OpenAI-compatible format, YouQi AI exposes the Google Gemini native API, compatible with the official Gemini request / response structure, so you can use Google's SDK or an existing Gemini integration directly. This page covers text-only chat; for image / PDF / audio / video recognition see Gemini Media Recognition.
Endpoint & authentication
| Item | Value |
|---|---|
| Base URL | https://ai.youqi.tech/v1beta |
| Generate content | POST /v1beta/models/{model}:generateContent |
| Streaming | POST /v1beta/models/{model}:streamGenerateContent |
| List models | GET /v1beta/models |
| Auth | query param ?key=<YOUR_API_KEY> or header x-goog-api-key: <YOUR_API_KEY> |
Different Base URL
The Gemini native surface uses the Base URL https://ai.youqi.tech/v1beta (not /v1), and authenticates via the ?key= query parameter or the x-goog-api-key header. The API key is still the sk-... key you create in the console.
Generate content
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
contents | array | Yes | Conversation contents, each with role (user / model) and parts |
parts[].text | string | Yes | Text content (or inline_data for images and other multimodal input) |
systemInstruction | object | No | System instruction |
generationConfig | object | No | Generation config such as temperature, topP, maxOutputTokens |
tools | array | No | Tool / function declarations |
Request example
curl "https://ai.youqi.tech/v1beta/models/gemini-1.5-pro:generateContent?key=sk-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"contents": [
{ "role": "user", "parts": [{ "text": "Introduce Hangzhou in one sentence." }] }
]
}'Passing the key via header (equivalent):
curl "https://ai.youqi.tech/v1beta/models/gemini-1.5-pro:generateContent" \
-H "x-goog-api-key: sk-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "contents": [{ "role": "user", "parts": [{ "text": "Hello" }] }] }'Response example
{
"candidates": [
{
"content": {
"role": "model",
"parts": [
{ "text": "Hangzhou is a city famed for West Lake, blending deep history with a vibrant digital economy." }
]
},
"finishReason": "STOP"
}
],
"usageMetadata": {
"promptTokenCount": 8,
"candidatesTokenCount": 22,
"totalTokenCount": 30
}
}Streaming
Change the endpoint method to :streamGenerateContent; the server returns JSON in chunks:
curl "https://ai.youqi.tech/v1beta/models/gemini-1.5-pro:streamGenerateContent?key=sk-YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "contents": [{ "role": "user", "parts": [{ "text": "Write a short poem about autumn" }] }] }'Note
If you use the OpenAI SDK, you can also call Gemini models via the Chat endpoint (/v1/chat/completions) — the gateway handles protocol conversion automatically. The native /v1beta API suits existing Google SDK integrations or Gemini-specific structures. For image / PDF / audio / video recognition, see Gemini Media Recognition.