OhMyGPT
Chat

Generate content (Gemini)

POST
/v1/models/{creator}/{model}:generateContent

Google Gemini generateContent, the endpoint the Google Gen AI SDKs call with base URL https://api.ohmygpt.com and API version v1. The model ID goes in the path, slash included: /v1/models/google/gemini-3.1-flash-lite:generateContent. Prefix it with provider: to pin one provider, as in /v1/models/google:google/gemini-3.1-flash-lite:generateContent. Gemini models and every other chat model in the catalog accept the same request and answer with a GenerateContentResponse.

Authorization

headerAuthorization<token>

Path Parameters

creator*string

The part of the model ID before the slash (google in google/gemini-3.1-flash-lite). To pin a provider, prefix it with provider:, as in google:google.

model*string

The part of the model ID after the slash (gemini-3.1-flash-lite).

Request Body

application/json
  1. body

A Gemini GenerateContentRequest as sent over REST. The model is named in the path, so the body has no model; every other field is Google's.

cachedContent?string

A cached content name (cachedContents/{id}); Gemini models only.

contents*array<>

The conversation so far; one item for a single-turn request.

generationConfig?

Configuration options for model generation and outputs. Not all parameters are configurable for every model.

labels?
safetySettings?array<>
serviceTier?GeminiServiceTier
Value in"unspecified""standard""flex""priority"
store?boolean
systemInstruction?

The base structured datatype containing multi-part content of a message.

A Content includes a role field designating the producer of the Content and a parts field containing multi-part data that contains the content of the message turn.

toolConfig?

The Tool configuration containing parameters for specifying Tool use in the request.

tools?array<>

Response Body

Successful response

application/json
  1. response

Response from the model supporting multiple candidate responses.

Safety ratings and content filtering are reported for both prompt in GenerateContentResponse.prompt_feedback and for each candidate in finish_reason and in safety_ratings. The API:

  • Returns either all requested candidates or none of them
  • Returns no candidates at all only if there was something wrong with the prompt (check prompt_feedback)
  • Reports feedback on each candidate in finish_reason and safety_ratings.
candidates?array<>

Candidate responses from the model.

modelStatus?

Output only. The current model status of this model.

modelVersion?string

Output only. The model version used to generate the response.

promptFeedback?

Returns the prompt's feedback related to the content filters.

responseId?string

Output only. response_id is used to identify each response.

usageMetadata?

Output only. Metadata on the generation requests' token usage.

Example Request
curl -X POST 'https://api.ohmygpt.com/v1/models/string/string:generateContent' \  -H 'Content-Type: application/json' \  -d '{  "contents": [    {}  ]}'
Example Response
{  "candidates": [    {      "avgLogprobs": 0.1,      "citationMetadata": {        "citationSources": [          {}        ]      },      "content": {        "parts": [          {            "audioTranscription": null,            "codeExecutionResult": null,            "executableCode": null,            "fileData": null,            "functionCall": null,            "functionResponse": null,            "inlineData": null,            "mediaProcessing": "MEDIA_PROCESSING_UNSPECIFIED",            "mediaResolution": null,            "partMetadata": {              "property1": null,              "property2": null            },            "speechMetadata": null,            "text": "string",            "thought": true,            "thoughtSignature": "string",            "toolCall": null,            "toolResponse": null,            "videoMetadata": null          }        ],        "role": "string"      },      "continuationToken": "string",      "finishMessage": "string",      "finishReason": "FINISH_REASON_UNSPECIFIED",      "groundingAttributions": [        {          "content": {            "parts": [              {                "audioTranscription": null,                "codeExecutionResult": null,                "executableCode": null,                "fileData": null,                "functionCall": null,                "functionResponse": null,                "inlineData": null,                "mediaProcessing": "MEDIA_PROCESSING_UNSPECIFIED",                "mediaResolution": null,                "partMetadata": {                  "property1": null,                  "property2": null                },                "speechMetadata": null,                "text": "string",                "thought": true,                "thoughtSignature": "string",                "toolCall": null,                "toolResponse": null,                "videoMetadata": null              }            ],            "role": "string"          },          "sourceId": null        }      ],      "groundingMetadata": {        "googleMapsWidgetContextToken": "string",        "groundingChunks": [          {}        ],        "groundingSupports": [          {}        ],        "imageSearchQueries": [          "string"        ],        "retrievalMetadata": null,        "searchEntryPoint": null,        "webSearchQueries": [          "string"        ]      },      "index": 0,      "logprobsResult": {        "chosenCandidates": [          {}        ],        "logProbabilitySum": 0.1,        "topCandidates": [          {}        ]      },      "safetyRatings": [        {          "blocked": true,          "category": "HARM_CATEGORY_UNSPECIFIED",          "probability": "HARM_PROBABILITY_UNSPECIFIED"        }      ],      "tokenCount": 0,      "urlContextMetadata": {        "urlMetadata": [          {}        ]      }    }  ],  "modelStatus": {    "message": "string",    "modelStage": "MODEL_STAGE_UNSPECIFIED",    "retirementTime": "2019-08-24T14:15:22Z"  },  "modelVersion": "string",  "promptFeedback": {    "blockReason": "BLOCK_REASON_UNSPECIFIED",    "safetyRatings": [      {        "blocked": true,        "category": "HARM_CATEGORY_UNSPECIFIED",        "probability": "HARM_PROBABILITY_UNSPECIFIED"      }    ]  },  "responseId": "string",  "usageMetadata": {    "cacheTokensDetails": [      {        "modality": null,        "tokenCount": 0      }    ],    "cachedContentTokenCount": 0,    "candidatesTokenCount": 0,    "candidatesTokensDetails": [      {        "modality": null,        "tokenCount": 0      }    ],    "promptTokenCount": 0,    "promptTokensDetails": [      {        "modality": null,        "tokenCount": 0      }    ],    "serviceTier": "unspecified",    "thoughtsTokenCount": 0,    "toolUsePromptTokenCount": 0,    "toolUsePromptTokensDetails": [      {        "modality": null,        "tokenCount": 0      }    ],    "totalTokenCount": 0  }}