---
title: "Google Gemini generateContent on a PopNow text model"
method: POST
path: "/v1beta/models/{model}:generateContent"
tags: ["OpenAI Compatible"]
---

# Google Gemini generateContent on a PopNow text model

`POST /v1beta/models/{model}:generateContent`

## Request

- Base URL: `https://api.popnow.ai`
- URL: `https://api.popnow.ai/v1beta/models/{model}:generateContent`
- Auth: HTTP bearer

Accepts a Google Gemini `generateContent` request (`contents` with
text / inlineData / functionCall / functionResponse parts,
`systemInstruction`, `tools.functionDeclarations`, `toolConfig`,
`generationConfig` such as `temperature`, `topP`, `maxOutputTokens`,
`stopSequences`, `responseMimeType`, `responseSchema`,
`thinkingConfig`). `{model}` is a PopNow text model identifier from
`/v1/models` and may contain a slash (for example
`google/gemini-3-flash-preview`). Validation, pricing and availability are
identical to `/v1/chat/completions`. The response is one
`GenerateContentResponse`. Errors use the Google
`{error:{code,message,status}}` shape. A call still running after about
30 seconds is kept open with leading whitespace and the
`X-PopNow-Keepalive: 1` header, as described on
`/v1/chat/completions`; a failure after that point is the same error
object inside a `200` response.

Billing: chat models are priced per token in credits (1 credit = $0.001), listed per 1M input and output
tokens in `credits` on `GET /api/v1/models` and `GET /v1/models`. When the request is accepted, the most it
can cost is held from your balance, computed from the input and `max_tokens` (the model's maximum output when
you omit it, so set `max_tokens` to keep holds small). When the reply ends you are charged its actual usage in
fractional credits, with no per-request minimum, and the rest of the hold is released. A balance below the
hold, or a key spend limit that would be exceeded, returns `402` before anything is sent to the model. A request
that fails or that the model refuses is refunded in full. The `X-PopNow-Task-Id` response header names the task;
`GET /api/v1/jobs/recordInfo` shows the final charge in `cost` (USD) and `exactCredits`. Message text is not
kept after the charge settles. Requests are forwarded to the model as sent and each model's own usage policy applies.

## Path parameters

- `model` string, required

## Headers

- `Idempotency-Key` string

## Request body

- GeminiGenerateContentRequest: Google Gemini `generateContent` request. Which generation parameters a model accepts comes from that model's `inputSchema` in `/v1/models` and the catalog. Sampling parameters the model does not declare (temperature, topP, topK, penalties) are ignored and listed in the `X-PopNow-Ignored-Params` response header; any other unsupported parameter returns 400.
  - `contents` object[], required
    - `role` 'user' | 'model'
    - `parts` object[]
  - `systemInstruction` object
  - `tools` object[]
  - `toolConfig` object
  - `generationConfig` object
    - `temperature` number
    - `topP` number
    - `maxOutputTokens` integer
    - `stopSequences` string[]
    - `responseMimeType` string
    - `responseSchema` object
    - `thinkingConfig` object

## Response `200`

One `GenerateContentResponse`.

- GeminiGenerateContentResponse
  - `candidates` object[]
    - `index` integer
    - `content` object
      - `role` string
      - `parts` object[]
    - `finishReason` string
  - `usageMetadata` object
    - `promptTokenCount` integer
    - `candidatesTokenCount` integer
    - `totalTokenCount` integer
    - `cachedContentTokenCount` integer
    - `thoughtsTokenCount` integer
  - `modelVersion` string: The PopNow model identifier.
  - `responseId` string

## Other responses

- `400`: Error in the Google `{error:{code,message,status}}` shape. `status` is the google.rpc code name (for example `INVALID_ARGUMENT`, `UNAUTHENTICATED`, `RESOURCE_EXHAUSTED`).
- `401`: Error in the Google `{error:{code,message,status}}` shape. `status` is the google.rpc code name (for example `INVALID_ARGUMENT`, `UNAUTHENTICATED`, `RESOURCE_EXHAUSTED`).
- `402`: Error in the Google `{error:{code,message,status}}` shape. `status` is the google.rpc code name (for example `INVALID_ARGUMENT`, `UNAUTHENTICATED`, `RESOURCE_EXHAUSTED`).
- `403`: Error in the Google `{error:{code,message,status}}` shape. `status` is the google.rpc code name (for example `INVALID_ARGUMENT`, `UNAUTHENTICATED`, `RESOURCE_EXHAUSTED`).
- `404`: Error in the Google `{error:{code,message,status}}` shape. `status` is the google.rpc code name (for example `INVALID_ARGUMENT`, `UNAUTHENTICATED`, `RESOURCE_EXHAUSTED`).
- `409`: Error in the Google `{error:{code,message,status}}` shape. `status` is the google.rpc code name (for example `INVALID_ARGUMENT`, `UNAUTHENTICATED`, `RESOURCE_EXHAUSTED`).
- `413`: Error in the Google `{error:{code,message,status}}` shape. `status` is the google.rpc code name (for example `INVALID_ARGUMENT`, `UNAUTHENTICATED`, `RESOURCE_EXHAUSTED`).
- `429`: Error in the Google `{error:{code,message,status}}` shape. `status` is the google.rpc code name (for example `INVALID_ARGUMENT`, `UNAUTHENTICATED`, `RESOURCE_EXHAUSTED`).
- `500`: Error in the Google `{error:{code,message,status}}` shape. `status` is the google.rpc code name (for example `INVALID_ARGUMENT`, `UNAUTHENTICATED`, `RESOURCE_EXHAUSTED`).
- `503`: Error in the Google `{error:{code,message,status}}` shape. `status` is the google.rpc code name (for example `INVALID_ARGUMENT`, `UNAUTHENTICATED`, `RESOURCE_EXHAUSTED`).

---

[API](https://skmtc.dev/popnow/apis/popnow-api.md) · [All operations](https://skmtc.dev/popnow/apis/popnow-api/llms.txt) · [OpenAPI document](https://skmtc.dev/popnow/apis/popnow-api/revisions/ba5c069f11d8?raw)
