Skip to main content
POST
Chat Completions (Gemini)
This endpoint speaks the OpenAI Chat Completions API format: request body, response body, streaming chunks and error shapes are the same as OpenAI’s. Point the official OpenAI SDK at our base URL and use your ModelHunter.AI API key.

Models

Body Parameters

The body follows the OpenAI Chat Completions API. The most common fields:
string
required
One of the models above.
object[]
required
Conversation: [{ "role": "system" | "user" | "assistant", "content": string | content parts }]. Content parts may include image_url images.
integer
Maximum output tokens. max_completion_tokens is also accepted.
boolean
default:false
Stream the response as chat.completion.chunk server-sent events, ending with data: [DONE]. The final chunk always includes usage.
number
Sampling temperature.
Other Chat Completions fields (top_p, stop, response_format, stream_options) are passed through unchanged.
Gemini models currently support chat requests; tool calling for agents may not work yet.

Long requests and streaming

Use "stream": true for reasoning models and long outputs. Tokens arrive as they are generated, so long answers never sit idle on the connection. While a stream is waiting for the model (for example while it is thinking), we send : keepalive SSE comments every 15 seconds; SSE clients and the official SDKs ignore them.Non-streaming requests that take longer than 15 seconds are also kept alive: the response starts with 200 OK and leading whitespace (ignored by JSON parsers) until the result is ready. If such a request fails after that point, the error is returned in the response body with status 200 instead of an error status, so check the body for an error field.

Billing

Each call is billed per token at the official price. When the request starts, an upper bound on its cost (estimated input + at least 8,192 output tokens, since Gemini thinking is not capped by max_tokens) is held from your balance. When it finishes you are charged for the tokens actually used and the rest is released. Failed requests are not charged.