AI

Generate text using AI

Generate text using large language models. Set stream: true for a streaming data stream compatible with the useChat hook. Set search: true to enable real-time web search with any model; the pages used are returned in sources. Include image URLs in messages content for multimodal input.

post/api/ai/{project_id}/text

Request

  • Base URL
    https://core.blink.new
  • URL
    https://core.blink.new/api/ai/{project_id}/text
  • Auth
    HTTP bearer

Path parameters

project_idstring required
Example:my-project-123

Unique identifier for the project

Request body

modelstring

AI model to use

promptstring

Text prompt for generation (alternative to messages)

streamboolean

Enable streaming response. When true, returns data stream format instead of JSON.

searchboolean

Enable web search using OpenAI's native web search tool. Only works with OpenAI models (gpt-, o1-, o3-*). Gracefully ignored for non-OpenAI models.

maxStepsinteger

Maximum number of sequential LLM calls (steps) for tool usage. Automatically set to 25 when tools are present, but can be overridden. Default is 1 when no tools are used.

experimental_continueStepsboolean

Enable continue steps for multi-step tool usage. Automatically set to true when tools are present, but can be overridden. Default is false when no tools are used.

maxTokensinteger

Maximum number of tokens to generate

temperaturenumber

Sampling temperature (0.0 to 2.0)

topPnumber

Nucleus sampling parameter

frequencyPenaltynumber

Frequency penalty (-2.0 to 2.0)

presencePenaltynumber

Presence penalty (-2.0 to 2.0)

Example request

{
  "messages": [
    {
      "content": [
        {
          "image": "https://example.com/image.jpg"
        }
      ]
    }
  ]
}

Response

Text generation successful

Example response

{
  "result": {
    "text": "In a small workshop at the edge of a bustling city, a robot named Artie was born...",
    "steps": [
      {
        "stepType": "initial"
      }
    ]
  },
  "metadata": {
    "provider": "google-gemini"
  }
}

Changes

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