Text

Chat Completions

Generate text responses using AI models. Fully compatible with the OpenAI Chat Completions API — use any OpenAI SDK by pointing it to https://gen.pollinations.ai.

Supports streaming, function calling, vision (image input), structured outputs, and reasoning/thinking modes depending on the model. JSON request bodies may be up to 100 MiB when inline media use image_url.url, video_url.url, or file.file_url data URIs. Larger requests also accept PDF file_data on OpenRouter models (a PDF data URI or raw base64 with mime_type application/pdf) and base64 input_audio.data on thinkingmachines/inkling. For requests over 32 MiB, each inline media item may be up to 20 MiB and the chat JSON must shrink below 16 MiB after media are replaced with URLs. Stored media are unlisted but publicly readable for provider access; retention is 30 days.

Successful text JSON responses contain usage. Text streams contain a usage chunk before [DONE]; missing text-provider usage fails the response.

Metadata is passed unchanged to endpoint agents; see the agent’s documentation for supported keys.

Media models that advertise this endpoint in /models also accept text prompts. Only the last user message's text is used (or a string input on Responses); history, instructions and text-generation settings are ignored. Empty prompts, malformed Unicode and prompts consisting only of . or .. return HTTP 400. Attachments are not supported; reference-required models return their normal missing-input error. Dialogue models expect one <voice>: <text> turn per line. Images return a Markdown image embed; audio, video and 3D return a Markdown link. Both include the plain public URL. With stream: true, events are emitted after generation finishes. Media is billed normally, without text-token usage: Responses returns usage: null; Chat JSON omits usage, while Chat streaming chunks contain usage: null and have no final usage chunk. Use the native media endpoints for generation settings.

post/v1/chat/completions

Request

  • Base URL: https://gen.pollinations.ai
  • URL: https://gen.pollinations.ai/v1/chat/completions
  • Auth: HTTP bearer

Request body

modelstring

AI model for text generation. See /v1/models for full list.

metadataobject nullable

Passed unchanged to endpoint agents. Each agent documents the metadata keys it accepts.

modalitiesstring[]
frequency_penaltynumber nullable
repetition_penaltynumber nullable
logit_biasobject nullable
logprobsboolean nullable
top_logprobsinteger nullable
max_tokensinteger nullable
presence_penaltynumber nullable
seedinteger nullable
stopstring[]
streamboolean nullable
reasoning_effort'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'

Requests reasoning depth for models that support adjustable reasoning. "none" requests no reasoning.

temperaturenumber nullable

Sampling controls are ignored for model families that do not consistently support them, regardless of reasoning mode.

top_pnumber nullable
parallel_tool_callsboolean
userstring
prompt_cache_keystring
prompt_cache_retention'in_memory' | '24h'

Response

Chat completion JSON or SSE stream

OR

Changes

No recorded changes to this operation across all 1 revision of this API.