FriendliAI Serverless.Token API
The Serverless.Token API from FriendliAI — 2 operation(s) for serverless.token.
The Serverless.Token API from FriendliAI — 2 operation(s) for serverless.token.
openapi: 3.1.0
info:
title: Friendli Suite API Reference Container.Audio Serverless.Token API
description: This is an OpenAPI reference of Friendli Suite API.
termsOfService: https://friendli.ai/terms-of-service
contact:
name: FriendliAI Support Team
email: support@friendli.ai
version: 0.1.0
servers:
- url: https://api.friendli.ai
tags:
- name: Serverless.Token
paths:
/serverless/v1/tokenize:
post:
tags:
- Serverless.Token
summary: Tokenization
description: Convert text input into token IDs.
operationId: serverlessTokenization
security:
- token: []
parameters:
- name: X-Friendli-Team
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: ID of team to run requests as (optional parameter).
title: X-Friendli-Team
description: ID of team to run requests as (optional parameter).
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ServerlessTokenizationBody'
responses:
'200':
description: Successfully tokenized the text.
content:
application/json:
schema:
$ref: '#/components/schemas/ServerlessTokenizationSuccess'
examples:
Example:
value:
tokens:
- 128000
- 3923
- 374
- 1803
- 1413
- 15592
- 30
'422':
description: Unprocessable Entity
x-speakeasy-name-override: tokenize
x-mint:
metadata:
title: Model APIs Tokenization
sidebarTitle: Tokenization
og:title: Model APIs Tokenization
description: Convert text input into token IDs.
og:description: Convert text input into token IDs.
href: /openapi/model-apis/tokenization
content: 'Convert text input into token IDs.
To request successfully, it is mandatory to enter a **Personal API Key** (e.g. flp_XXX) value in the **Bearer Token** field.
Refer to the [authentication section](/openapi/introduction#authentication) on our introduction page to learn how to acquire this variable and [visit here](https://friendli.ai/suite/~/setting/keys) to generate your API Key.'
/serverless/v1/detokenize:
post:
tags:
- Serverless.Token
summary: Detokenization
description: Convert a list of token IDs back into text.
operationId: serverlessDetokenization
security:
- token: []
parameters:
- name: X-Friendli-Team
in: header
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: ID of team to run requests as (optional parameter).
title: X-Friendli-Team
description: ID of team to run requests as (optional parameter).
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ServerlessDetokenizationBody'
responses:
'200':
description: Successfully detokenized the tokens.
content:
application/json:
schema:
$ref: '#/components/schemas/ServerlessDetokenizationSuccess'
examples:
Example:
value:
text: What is generative AI?
'422':
description: Unprocessable Entity
x-speakeasy-name-override: detokenize
x-mint:
metadata:
title: Model APIs Detokenization
sidebarTitle: Detokenization
og:title: Model APIs Detokenization
description: Convert a list of token IDs back into text.
og:description: Convert a list of token IDs back into text.
href: /openapi/model-apis/detokenization
content: 'Convert a list of token IDs back into text.
To request successfully, it is mandatory to enter a **Personal API Key** (e.g. flp_XXX) value in the **Bearer Token** field.
Refer to the [authentication section](/openapi/introduction#authentication) on our introduction page to learn how to acquire this variable and [visit here](https://friendli.ai/suite/~/setting/keys) to generate your API Key.'
components:
schemas:
ServerlessDetokenizationBody:
properties:
model:
type: string
title: Model
description: Code of the model to use. See [available model list](https://friendli.ai/docs/guides/model-apis/pricing#billing-methods).
examples:
- zai-org/GLM-5.2
tokens:
items:
type: integer
type: array
title: Tokens
description: A token sequence to detokenize.
examples:
- - 128000
- 3923
- 374
- 1803
- 1413
- 15592
- 30
type: object
required:
- model
- tokens
title: ServerlessDetokenizationBody
example:
model: zai-org/GLM-5.2
tokens:
- 128000
- 3923
- 374
- 1803
- 1413
- 15592
- 30
ServerlessTokenizationSuccess:
properties:
tokens:
items:
type: integer
type: array
title: Tokens
description: A list of token IDs.
type: object
required:
- tokens
title: ServerlessTokenizationSuccess
ServerlessDetokenizationSuccess:
properties:
text:
type: string
title: Text
description: Detokenized text output.
type: object
required:
- text
title: ServerlessDetokenizationSuccess
ServerlessTokenizationBody:
properties:
model:
type: string
title: Model
description: Code of the model to use. See [available model list](https://friendli.ai/docs/guides/model-apis/pricing#billing-methods).
examples:
- zai-org/GLM-5.2
prompt:
type: string
title: Prompt
description: Input text prompt to tokenize.
examples:
- What is generative AI?
type: object
required:
- model
- prompt
title: ServerlessTokenizationBody
example:
model: zai-org/GLM-5.2
prompt: What is generative AI?
securitySchemes:
token:
type: http
description: 'When using Friendli Suite API for inference requests, you need to provide a **Friendli Token** for authentication and authorization purposes.
For more detailed information, please refer [here](https://friendli.ai/docs/openapi/introduction#authentication).'
scheme: bearer
x-speakeasy-retries:
strategy: backoff
backoff:
initialInterval: 500
maxInterval: 60000
maxElapsedTime: 3600000
exponent: 1.5
statusCodes:
- 429
- 500
- 502
- 503
- 504
retryConnectionErrors: true