IBM

IBM Text Generation API

Generate text using foundation models.

GitHub OpenAPI
Business capability
Model Inference AE-110.10

Operations 3

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

POST /ml/v1/text/generation Generate text from a prompt · International Business Machines Generate text #
Ask an LLM
“How do I get a model to continue a prompt?”
“Can I set generation parameters like temperature when generating text?”
Tell an agent
Generate text with model {model_id} on project {project_id} for prompt {input}.
Continue {input} using model {model_id} in project {project_id} with parameters {parameters}.
POST /ml/v1/text/generation_stream Stream generated text token by token · International Business Machines Generate text (streaming) #
Ask an LLM
“Can I stream the model's output as it generates tokens?”
“Is there a streaming version of text generation?”
Tell an agent
Stream text generation for {input} with model {model_id} in project {project_id}.
Stream model {model_id} output on project {project_id} for prompt {input} using parameters {parameters}.
POST /ml/v1/text/tokenization Tokenize text with a model · International Business Machines Tokenize text #
Ask an LLM
“How do I see what a model splits my text into tokens?”
“Can I tokenize text with a specific model?”
Tell an agent
Tokenize {input} with model {model_id} in project {project_id}.
Break {input} into tokens using model {model_id} on project {project_id}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/ibm:ibm-text-generation-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

ibm-text-generation-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: International Business Machines IBM watsonx.ai Text… Text…
  description: The IBM watsonx.ai API enables developers to run text inference, prompt tuning, and other operations on Large Language Models (LLMs). It provides access to multiple open source and IBM foundation models through a unified REST interface for text generation, embeddings, and model management.
  version: 1.0.0
  contact:
    name: IBM Cloud
    url: https://cloud.ibm.com/apidocs/watsonx-ai
  license:
    name: IBM Cloud Terms
    url: https://www.ibm.com/terms
servers:
- url: https://us-south.ml.cloud.ibm.com
  description: US South (Dallas)
- url: https://eu-de.ml.cloud.ibm.com
  description: EU Central (Frankfurt)
- url: https://eu-gb.ml.cloud.ibm.com
  description: EU (London)
- url: https://jp-tok.ml.cloud.ibm.com
  description: AP (Tokyo)
security:
- bearerAuth: []
tags:
- name: Text Generation
  description: Generate text using foundation models.
paths:
  /ml/v1/text/generation:
    post:
      operationId: textGeneration
      summary: International Business Machines Generate text
      description: Infer the next tokens for a given deployed model with a set of parameters.
      tags:
      - Text Generation
      parameters:
      - name: version
        in: query
        required: true
        schema:
          type: string
        description: The API version date.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextGenerationRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TextGenerationResponse'
        '400':
          description: Bad request
        '401':
          description: Unauthorized
  /ml/v1/text/generation_stream:
    post:
      operationId: textGenerationStream
      summary: International Business Machines Generate text (streaming)
      description: Infer the next tokens for a given deployed model with a set of parameters, returning results as a stream.
      tags:
      - Text Generation
      parameters:
      - name: version
        in: query
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TextGenerationRequest'
      responses:
        '200':
          description: Successful streaming response
          content:
            text/event-stream:
              schema:
                type: string
  /ml/v1/text/tokenization:
    post:
      operationId: textTokenization
      summary: International Business Machines Tokenize text
      description: Return the tokens for the provided text with the given model.
      tags:
      - Text Generation
      parameters:
      - name: version
        in: query
        required: true
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TokenizationRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TokenizationResponse'
components:
  schemas:
    TextGenerationRequest:
      type: object
      required:
      - model_id
      - input
      - project_id
      properties:
        model_id:
          type: string
          description: The ID of the model to use.
        input:
          type: string
          description: The prompt text.
        project_id:
          type: string
          description: The project ID.
        parameters:
          type: object
          properties:
            max_new_tokens:
              type: integer
            temperature:
              type: number
            top_p:
              type: number
            top_k:
              type: integer
            repetition_penalty:
              type: number
            stop_sequences:
              type: array
              items:
                type: string
    TokenizationRequest:
      type: object
      required:
      - model_id
      - input
      - project_id
      properties:
        model_id:
          type: string
        input:
          type: string
        project_id:
          type: string
    TokenizationResponse:
      type: object
      properties:
        model_id:
          type: string
        result:
          type: object
          properties:
            token_count:
              type: integer
            tokens:
              type: array
              items:
                type: string
    TextGenerationResponse:
      type: object
      properties:
        model_id:
          type: string
        created_at:
          type: string
        results:
          type: array
          items:
            type: object
            properties:
              generated_text:
                type: string
              generated_token_count:
                type: integer
              input_token_count:
                type: integer
              stop_reason:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: IAM Token