LocalAI Tokenize API

The tokenize API from LocalAI — 4 operation(s) for tokenize.

Operations 4

GET /tokenMetrics Get TokenMetrics for Active Slot.
POST /v1/detokenize Detokenize the input.
GET /v1/tokenMetrics Get TokenMetrics for Active Slot.
POST /v1/tokenize Tokenize the input.

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/localai-tokenize-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no email required.

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

OpenAPI Specification

localai-tokenize-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  description: The LocalAI Rest API.
  title: LocalAI Tokenize API
  contact:
    name: LocalAI
    url: https://localai.io
  license:
    name: MIT
    url: https://raw.githubusercontent.com/mudler/LocalAI/master/LICENSE
  version: 2.0.0
servers:
- url: /
tags:
- name: tokenize
paths:
  /tokenMetrics:
    get:
      tags:
      - tokenize
      summary: Get TokenMetrics for Active Slot.
      responses:
        '200':
          description: generated audio/wav file
          content:
            audio/x-wav:
              schema:
                type: string
  /v1/detokenize:
    post:
      tags:
      - tokenize
      summary: Detokenize the input.
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schema.DetokenizeResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/schema.DetokenizeRequest'
        description: Request
        required: true
  /v1/tokenMetrics:
    get:
      tags:
      - tokenize
      summary: Get TokenMetrics for Active Slot.
      responses:
        '200':
          description: generated audio/wav file
          content:
            audio/x-wav:
              schema:
                type: string
  /v1/tokenize:
    post:
      tags:
      - tokenize
      summary: Tokenize the input.
      responses:
        '200':
          description: Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schema.TokenizeResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/schema.TokenizeRequest'
        description: Request
        required: true
components:
  schemas:
    schema.TokenizeRequest:
      type: object
      properties:
        content:
          description: text to tokenize
          type: string
        model:
          type: string
    schema.DetokenizeResponse:
      type: object
      properties:
        content:
          description: detokenized text
          type: string
    schema.TokenizeResponse:
      type: object
      properties:
        tokens:
          description: token IDs
          type: array
          items:
            type: integer
    schema.DetokenizeRequest:
      type: object
      properties:
        model:
          type: string
        tokens:
          description: token IDs to convert back to text
          type: array
          items:
            type: integer
  securitySchemes:
    BearerAuth:
      type: apiKey
      name: Authorization
      in: header