xAI · Capability

xAI's REST API — v1

xAI's REST API — v1. 33 operations. Lead operation: Get information about an API key, including name, status, permissions and users who created or modified this key.. Self-contained Naftiko capability covering one Xai business surface.

Run with Naftiko Xaiv1

What You Can Do

GET
Handlegetapikeyinforequest — Get information about an API key, including name, status, permissions and users who created or modified this key.
/v1/v1/api-key
POST
Handlegenericcompletionrequest — Create a chat response from text/image chat prompts. This is the endpoint for making requests to chat and image understanding models.
/v1/v1/chat/completions
GET
Handlegetdeferredcompletionrequest — Tries to fetch a result for a previously-started deferred completion. Returns `200 Success` with the response body, if the request has been completed. Returns `202 Accepted` when the request is pending processing.
/v1/v1/chat/deferred-completion/{request-id}
POST
Handlegenericcompleterequest — (Legacy - Not supported by reasoning models) Create a text completion response. This endpoint is compatible with the Anthropic API.
/v1/v1/complete
POST
Handlesamplerequest — (Legacy - Not supported by reasoning models) Create a text completion response for a given prompt. Replaced by /v1/chat/completions.
/v1/v1/completions
POST
Handledocumentsearchrequestv2 — Search for content related to the query within the given collections.
/v1/v1/documents/search
GET
Handleembeddingmodelslistrequest — List all embedding models available to the authenticating API key with full information. Additional information compared to /v1/models includes modalities, pricing, fingerprint and alias(es).
/v1/v1/embedding-models
GET
Handleembeddingmodelgetrequest — Get full information about an embedding model with its model_id.
/v1/v1/embedding-models/{model-id}
POST
Handleembeddingrequest — Create an embedding vector representation corresponding to the input text. This is the endpoint for making requests to embedding models.
/v1/v1/embeddings
GET
Handlelistfilesrequest — List files owned by the authenticated team, paginated. The response
/v1/v1/files
POST
Handleuploadfilerequest — Upload a file to xAI's storage. Returns the file's metadata. Files can
/v1/v1/files
GET
Handleretrievefilerequest — Retrieve metadata for a single file by ID. Errors with 404 if the file
/v1/v1/files/{file-id}
DELETE
Handledeletefilerequest — Delete a file by ID. After this returns, the file no longer appears in
/v1/v1/files/{file-id}
GET
Handledownloadfilecontentrequest — Download the contents of a file as a stream of raw bytes. The response
/v1/v1/files/{file-id}/content
GET
Handleimagegenerationmodelslistrequest — List all image generation models available to the authenticating API key with full information. Additional information compared to /v1/models includes modalities, pricing, fingerprint and alias(es).
/v1/v1/image-generation-models
GET
Handleimagegenerationmodelgetrequest — Get full information about an image generation model with its model_id.
/v1/v1/image-generation-models/{model-id}
POST
Handleeditimagerequest — Edit an image based on a prompt. This is the endpoint for making edit requests to image generation models.
/v1/v1/images/edits
POST
Handlegenerateimagerequest — Generate an image based on a prompt. This is the endpoint for making generation requests to image generation models.
/v1/v1/images/generations
GET
Handlelanguagemodelslistrequest — List all chat and image understanding models available to the authenticating API key with full information. Additional information compared to /v1/models includes modalities, pricing, fingerprint and alias(es).
/v1/v1/language-models
GET
Handlelanguagemodelgetrequest — Get full information about a chat or image understanding model with its model_id.
/v1/v1/language-models/{model-id}
POST
Handlegenericmessagesrequest — Create a messages response. This endpoint is compatible with the Anthropic API.
/v1/v1/messages
GET
Handlemodelslistrequest — List all models available to the authenticating API key with minimalized information, including model names (ID), creation times, etc.
/v1/v1/models
GET
Handlemodelgetrequest — Get minimalized information about a model with its model_id.
/v1/v1/models/{model-id}
POST
Handlegenericmodelrequest — Generates a response based on text or image prompts. The response ID can be used to retrieve the response later or to continue the conversation without repeating prior context. New responses will be stored for 30 days and then permanently d
/v1/v1/responses
GET
Handlegetstoredcompletionrequest — Retrieve a previously generated response.
/v1/v1/responses/{response-id}
DELETE
Handledeletestoredcompletionrequest — Delete a previously generated response.
/v1/v1/responses/{response-id}
POST
Handletokenizetextrequest — Tokenize text with the specified model
/v1/v1/tokenize-text
GET
Handlevideogenerationmodelslistrequest — List all video generation models available to the authenticating API key with full information.
/v1/v1/video-generation-models
GET
Handlevideogenerationmodelgetrequest — Get full information about a video generation model with its model_id.
/v1/v1/video-generation-models/{model-id}
POST
Handleeditvideorequest — Edit a video based on a prompt.
/v1/v1/videos/edits
POST
Handleextendvideorequest — Extend a video by generating continuation content.
/v1/v1/videos/extensions
POST
Handlegeneratevideorequest — Generate a video from a text prompt and optionally an image.
/v1/v1/videos/generations
GET
Handlegetdeferredvideorequest — Get the result of a deferred video generation request.
/v1/v1/videos/{request-id}

MCP Tools

get-information-about-api-key

Get information about an API key, including name, status, permissions and users who created or modified this key.

read-only idempotent
create-chat-response-text-image

Create a chat response from text/image chat prompts. This is the endpoint for making requests to chat and image understanding models.

tries-fetch-result-previously-started

Tries to fetch a result for a previously-started deferred completion. Returns `200 Success` with the response body, if the request has been completed. Returns `202 Accepted` when the request is pending processing.

read-only idempotent
legacy-not-supported-reasoning-models

(Legacy - Not supported by reasoning models) Create a text completion response. This endpoint is compatible with the Anthropic API.

legacy-not-supported-reasoning-models-2

(Legacy - Not supported by reasoning models) Create a text completion response for a given prompt. Replaced by /v1/chat/completions.

search-content-related-query-within

Search for content related to the query within the given collections.

read-only
list-all-embedding-models-available

List all embedding models available to the authenticating API key with full information. Additional information compared to /v1/models includes modalities, pricing, fingerprint and alias(es).

read-only idempotent
get-full-information-about-embedding

Get full information about an embedding model with its model_id.

read-only idempotent
create-embedding-vector-representation-corresponding

Create an embedding vector representation corresponding to the input text. This is the endpoint for making requests to embedding models.

list-files-owned-authenticated-team

List files owned by the authenticated team, paginated. The response

read-only idempotent
upload-file-xai-s-storage-returns

Upload a file to xAI's storage. Returns the file's metadata. Files can

retrieve-metadata-single-file-id

Retrieve metadata for a single file by ID. Errors with 404 if the file

read-only idempotent
delete-file-id-after-this

Delete a file by ID. After this returns, the file no longer appears in

idempotent
download-contents-file-stream-raw

Download the contents of a file as a stream of raw bytes. The response

read-only idempotent
list-all-image-generation-models

List all image generation models available to the authenticating API key with full information. Additional information compared to /v1/models includes modalities, pricing, fingerprint and alias(es).

read-only idempotent
get-full-information-about-image

Get full information about an image generation model with its model_id.

read-only idempotent
edit-image-based-prompt-this

Edit an image based on a prompt. This is the endpoint for making edit requests to image generation models.

generate-image-based-prompt-this

Generate an image based on a prompt. This is the endpoint for making generation requests to image generation models.

list-all-chat-and-image

List all chat and image understanding models available to the authenticating API key with full information. Additional information compared to /v1/models includes modalities, pricing, fingerprint and alias(es).

read-only idempotent
get-full-information-about-chat

Get full information about a chat or image understanding model with its model_id.

read-only idempotent
create-messages-response-this-endpoint

Create a messages response. This endpoint is compatible with the Anthropic API.

list-all-models-available-authenticating

List all models available to the authenticating API key with minimalized information, including model names (ID), creation times, etc.

read-only idempotent
get-minimalized-information-about-model

Get minimalized information about a model with its model_id.

read-only idempotent
generates-response-based-text-image

Generates a response based on text or image prompts. The response ID can be used to retrieve the response later or to continue the conversation without repeating prior context. New responses will be stored for 30 days and then permanently d

read-only
retrieve-previously-generated-response

Retrieve a previously generated response.

read-only idempotent
delete-previously-generated-response

Delete a previously generated response.

idempotent
tokenize-text-specified-model

Tokenize text with the specified model

list-all-video-generation-models

List all video generation models available to the authenticating API key with full information.

read-only idempotent
get-full-information-about-video

Get full information about a video generation model with its model_id.

read-only idempotent
edit-video-based-prompt

Edit a video based on a prompt.

extend-video-generating-continuation-content

Extend a video by generating continuation content.

generate-video-text-prompt-and

Generate a video from a text prompt and optionally an image.

get-result-deferred-video-generation

Get the result of a deferred video generation request.

read-only idempotent

Capability Spec

xai-v1.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: xAI's REST API — v1
  description: 'xAI''s REST API — v1. 33 operations. Lead operation: Get information about an API key, including name, status,
    permissions and users who created or modified this key.. Self-contained Naftiko capability covering one Xai business surface.'
  tags:
  - Xai
  - v1
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    XAI_API_KEY: XAI_API_KEY
capability:
  consumes:
  - type: http
    namespace: xai-v1
    baseUri: ''
    description: xAI's REST API — v1 business capability. Self-contained, no shared references.
    resources:
    - name: v1-api-key
      path: /v1/api-key
      operations:
      - name: handlegetapikeyinforequest
        method: GET
        description: Get information about an API key, including name, status, permissions and users who created or modified
          this key.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v1-chat-completions
      path: /v1/chat/completions
      operations:
      - name: handlegenericcompletionrequest
        method: POST
        description: Create a chat response from text/image chat prompts. This is the endpoint for making requests to chat
          and image understanding models.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-chat-deferred-completion-request_id
      path: /v1/chat/deferred-completion/{request_id}
      operations:
      - name: handlegetdeferredcompletionrequest
        method: GET
        description: Tries to fetch a result for a previously-started deferred completion. Returns `200 Success` with the
          response body, if the request has been completed. Returns `202 Accepted` when the request is pending processing.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: request_id
          in: path
          type: string
          description: The deferred request id returned by a previous deferred chat request.
          required: true
    - name: v1-complete
      path: /v1/complete
      operations:
      - name: handlegenericcompleterequest
        method: POST
        description: (Legacy - Not supported by reasoning models) Create a text completion response. This endpoint is compatible
          with the Anthropic API.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-completions
      path: /v1/completions
      operations:
      - name: handlesamplerequest
        method: POST
        description: (Legacy - Not supported by reasoning models) Create a text completion response for a given prompt. Replaced
          by /v1/chat/completions.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-documents-search
      path: /v1/documents/search
      operations:
      - name: handledocumentsearchrequestv2
        method: POST
        description: Search for content related to the query within the given collections.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-embedding-models
      path: /v1/embedding-models
      operations:
      - name: handleembeddingmodelslistrequest
        method: GET
        description: List all embedding models available to the authenticating API key with full information. Additional information
          compared to /v1/models includes modalities, pricing, fingerprint and alias(es).
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v1-embedding-models-model_id
      path: /v1/embedding-models/{model_id}
      operations:
      - name: handleembeddingmodelgetrequest
        method: GET
        description: Get full information about an embedding model with its model_id.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: model_id
          in: path
          type: string
          description: ID of the model to get.
          required: true
    - name: v1-embeddings
      path: /v1/embeddings
      operations:
      - name: handleembeddingrequest
        method: POST
        description: Create an embedding vector representation corresponding to the input text. This is the endpoint for making
          requests to embedding models.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-files
      path: /v1/files
      operations:
      - name: handlelistfilesrequest
        method: GET
        description: List files owned by the authenticated team, paginated. The response
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: limit
          in: query
          type: integer
          description: The maximum number of objects to be returned in a single response.
        - name: order
          in: query
          type: string
          description: The ordering to sort the returned files. Use `asc` for ascending and `desc` for descending order.
        - name: sort_by
          in: query
          type: string
          description: 'The field to sort by. Valid options: `created_at`, `filename`, `size`. Defaults to `created_at`.'
        - name: pagination_token
          in: query
          type: string
          description: The pagination token returned by the previous list files request.
        - name: after
          in: query
          type: string
          description: Only included for compatibility. Use `pagination_token` instead.
      - name: handleuploadfilerequest
        method: POST
        description: Upload a file to xAI's storage. Returns the file's metadata. Files can
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-files-file_id
      path: /v1/files/{file_id}
      operations:
      - name: handleretrievefilerequest
        method: GET
        description: Retrieve metadata for a single file by ID. Errors with 404 if the file
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: file_id
          in: path
          type: string
          description: The file's `id` returned by upload or list.
          required: true
      - name: handledeletefilerequest
        method: DELETE
        description: Delete a file by ID. After this returns, the file no longer appears in
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: file_id
          in: path
          type: string
          description: The file's `id` to delete.
          required: true
    - name: v1-files-file_id-content
      path: /v1/files/{file_id}/content
      operations:
      - name: handledownloadfilecontentrequest
        method: GET
        description: Download the contents of a file as a stream of raw bytes. The response
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: file_id
          in: path
          type: string
          description: The file's `id` to download.
          required: true
        - name: format
          in: query
          type: string
          description: Format of the downloaded content.
    - name: v1-image-generation-models
      path: /v1/image-generation-models
      operations:
      - name: handleimagegenerationmodelslistrequest
        method: GET
        description: List all image generation models available to the authenticating API key with full information. Additional
          information compared to /v1/models includes modalities, pricing, fingerprint and alias(es).
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v1-image-generation-models-model_id
      path: /v1/image-generation-models/{model_id}
      operations:
      - name: handleimagegenerationmodelgetrequest
        method: GET
        description: Get full information about an image generation model with its model_id.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: model_id
          in: path
          type: string
          description: ID of the model to get.
          required: true
    - name: v1-images-edits
      path: /v1/images/edits
      operations:
      - name: handleeditimagerequest
        method: POST
        description: Edit an image based on a prompt. This is the endpoint for making edit requests to image generation models.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-images-generations
      path: /v1/images/generations
      operations:
      - name: handlegenerateimagerequest
        method: POST
        description: Generate an image based on a prompt. This is the endpoint for making generation requests to image generation
          models.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-language-models
      path: /v1/language-models
      operations:
      - name: handlelanguagemodelslistrequest
        method: GET
        description: List all chat and image understanding models available to the authenticating API key with full information.
          Additional information compared to /v1/models includes modalities, pricing, fingerprint and alias(es).
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v1-language-models-model_id
      path: /v1/language-models/{model_id}
      operations:
      - name: handlelanguagemodelgetrequest
        method: GET
        description: Get full information about a chat or image understanding model with its model_id.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: model_id
          in: path
          type: string
          description: ID of the model to get.
          required: true
    - name: v1-messages
      path: /v1/messages
      operations:
      - name: handlegenericmessagesrequest
        method: POST
        description: Create a messages response. This endpoint is compatible with the Anthropic API.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-models
      path: /v1/models
      operations:
      - name: handlemodelslistrequest
        method: GET
        description: List all models available to the authenticating API key with minimalized information, including model
          names (ID), creation times, etc.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v1-models-model_id
      path: /v1/models/{model_id}
      operations:
      - name: handlemodelgetrequest
        method: GET
        description: Get minimalized information about a model with its model_id.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: model_id
          in: path
          type: string
          description: ID of the model to get.
          required: true
    - name: v1-responses
      path: /v1/responses
      operations:
      - name: handlegenericmodelrequest
        method: POST
        description: Generates a response based on text or image prompts. The response ID can be used to retrieve the response
          later or to continue the conversation without repeating prior context. New responses will be stored for 30 days
          and then permanently d
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-responses-response_id
      path: /v1/responses/{response_id}
      operations:
      - name: handlegetstoredcompletionrequest
        method: GET
        description: Retrieve a previously generated response.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: response_id
          in: path
          type: string
          description: The response id returned by a previous create response request.
          required: true
      - name: handledeletestoredcompletionrequest
        method: DELETE
        description: Delete a previously generated response.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: response_id
          in: path
          type: string
          description: The response id returned by a previous create response request.
          required: true
    - name: v1-tokenize-text
      path: /v1/tokenize-text
      operations:
      - name: handletokenizetextrequest
        method: POST
        description: Tokenize text with the specified model
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-video-generation-models
      path: /v1/video-generation-models
      operations:
      - name: handlevideogenerationmodelslistrequest
        method: GET
        description: List all video generation models available to the authenticating API key with full information.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    - name: v1-video-generation-models-model_id
      path: /v1/video-generation-models/{model_id}
      operations:
      - name: handlevideogenerationmodelgetrequest
        method: GET
        description: Get full information about a video generation model with its model_id.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: model_id
          in: path
          type: string
          description: ID of the model to get.
          required: true
    - name: v1-videos-edits
      path: /v1/videos/edits
      operations:
      - name: handleeditvideorequest
        method: POST
        description: Edit a video based on a prompt.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-videos-extensions
      path: /v1/videos/extensions
      operations:
      - name: handleextendvideorequest
        method: POST
        description: Extend a video by generating continuation content.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-videos-generations
      path: /v1/videos/generations
      operations:
      - name: handlegeneratevideorequest
        method: POST
        description: Generate a video from a text prompt and optionally an image.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-videos-request_id
      path: /v1/videos/{request_id}
      operations:
      - name: handlegetdeferredvideorequest
        method: GET
        description: Get the result of a deferred video generation request.
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: request_id
          in: path
          type: string
          description: The deferred request id returned by a previous video generation request.
          required: true
    authentication:
      type: bearer
      token: '{{env.XAI_API_KEY}}'
  exposes:
  - type: rest
    namespace: xai-v1-rest
    port: 8080
    description: REST adapter for xAI's REST API — v1. One Spectral-compliant resource per consumed operation, prefixed with
      /v1.
    resources:
    - path: /v1/v1/api-key
      name: v1-api-key
      description: REST surface for v1-api-key.
      operations:
      - method: GET
        name: handlegetapikeyinforequest
        description: Get information about an API key, including name, status, permissions and users who created or modified
          this key.
        call: xai-v1.handlegetapikeyinforequest
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/chat/completions
      name: v1-chat-completions
      description: REST surface for v1-chat-completions.
      operations:
      - method: POST
        name: handlegenericcompletionrequest
        description: Create a chat response from text/image chat prompts. This is the endpoint for making requests to chat
          and image understanding models.
        call: xai-v1.handlegenericcompletionrequest
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/chat/deferred-completion/{request-id}
      name: v1-chat-deferred-completion-request-id
      description: REST surface for v1-chat-deferred-completion-request_id.
      operations:
      - method: GET
        name: handlegetdeferredcompletionrequest
        description: Tries to fetch a result for a previously-started deferred completion. Returns `200 Success` with the
          response body, if the request has been completed. Returns `202 Accepted` when the request is pending processing.
        call: xai-v1.handlegetdeferredcompletionrequest
        with:
          request_id: rest.request_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/complete
      name: v1-complete
      description: REST surface for v1-complete.
      operations:
      - method: POST
        name: handlegenericcompleterequest
        description: (Legacy - Not supported by reasoning models) Create a text completion response. This endpoint is compatible
          with the Anthropic API.
        call: xai-v1.handlegenericcompleterequest
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/completions
      name: v1-completions
      description: REST surface for v1-completions.
      operations:
      - method: POST
        name: handlesamplerequest
        description: (Legacy - Not supported by reasoning models) Create a text completion response for a given prompt. Replaced
          by /v1/chat/completions.
        call: xai-v1.handlesamplerequest
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/documents/search
      name: v1-documents-search
      description: REST surface for v1-documents-search.
      operations:
      - method: POST
        name: handledocumentsearchrequestv2
        description: Search for content related to the query within the given collections.
        call: xai-v1.handledocumentsearchrequestv2
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/embedding-models
      name: v1-embedding-models
      description: REST surface for v1-embedding-models.
      operations:
      - method: GET
        name: handleembeddingmodelslistrequest
        description: List all embedding models available to the authenticating API key with full information. Additional information
          compared to /v1/models includes modalities, pricing, fingerprint and alias(es).
        call: xai-v1.handleembeddingmodelslistrequest
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/embedding-models/{model-id}
      name: v1-embedding-models-model-id
      description: REST surface for v1-embedding-models-model_id.
      operations:
      - method: GET
        name: handleembeddingmodelgetrequest
        description: Get full information about an embedding model with its model_id.
        call: xai-v1.handleembeddingmodelgetrequest
        with:
          model_id: rest.model_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/embeddings
      name: v1-embeddings
      description: REST surface for v1-embeddings.
      operations:
      - method: POST
        name: handleembeddingrequest
        description: Create an embedding vector representation corresponding to the input text. This is the endpoint for making
          requests to embedding models.
        call: xai-v1.handleembeddingrequest
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/files
      name: v1-files
      description: REST surface for v1-files.
      operations:
      - method: GET
        name: handlelistfilesrequest
        description: List files owned by the authenticated team, paginated. The response
        call: xai-v1.handlelistfilesrequest
        with:
          limit: rest.limit
          order: rest.order
          sort_by: rest.sort_by
          pagination_token: rest.pagination_token
          after: rest.after
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: handleuploadfilerequest
        description: Upload a file to xAI's storage. Returns the file's metadata. Files can
        call: xai-v1.handleuploadfilerequest
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/files/{file-id}
      name: v1-files-file-id
      description: REST surface for v1-files-file_id.
      operations:
      - method: GET
        name: handleretrievefilerequest
        description: Retrieve metadata for a single file by ID. Errors with 404 if the file
        call: xai-v1.handleretrievefilerequest
        with:
          file_id: rest.file_id
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: handledeletefilerequest
        description: Delete a file by ID. After this returns, the file no longer appears in
        call: xai-v1.handledeletefilerequest
        with:
          file_id: rest.file_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/files/{file-id}/content
      name: v1-files-file-id-content
      description: REST surface for v1-files-file_id-content.
      operations:
      - method: GET
        name: handledownloadfilecontentrequest
        description: Download the contents of a file as a stream of raw bytes. The response
        call: xai-v1.handledownloadfilecontentrequest
        with:
          file_id: rest.file_id
          format: rest.format
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/image-generation-models
      name: v1-image-generation-models
      description: REST surface for v1-image-generation-models.
      operations:
      - method: GET
        name: handleimagegenerationmodelslistrequest
        description: List all image generation models available to the authenticating API key with full information. Additional
          information compared to /v1/models includes modalities, pricing, fingerprint and alias(es).
        call: xai-v1.handleimagegenerationmodelslistrequest
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/image-generation-models/{model-id}
      name: v1-image-generation-models-model-id
      description: REST surface for v1-image-generation-models-model_id.
      operations:
      - method: GET
        name: handleimagegenerationmodelgetrequest
        description: Get full information about an image generation model with its model_id.
        call: xai-v1.handleimagegenerationmodelgetrequest
        with:
          model_id: rest.model_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/images/edits
      name: v1-images-edits
      description: REST surface for v1-images-edits.
      operations:
      - method: POST
        name: handleeditimagerequest
        description: Edit an image based on a prompt. This is the endpoint for making edit requests to image generation models.
        call: xai-v1.handleeditimagerequest
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/images/generations
      name: v1-images-generations
      description: REST surface for v1-images-generations.
      operations:
      - method: POST
        name: handlegenerateimagerequest
        description: Generate an image based on a prompt. This is the endpoint for making generation requests to image generation
          models.
        call: xai-v1.handlegenerateimagerequest
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/language-models
      name: v1-language-models
      description: REST surface for v1-language-models.
      operations:
      - method: GET
        name: handlelanguagemodelslistrequest
        description: List all chat and image understanding models available to the authenticating API key with full information.
          Additional information compared to /v1/models includes modalities, pricing, fingerprint and alias(es).
        call: xai-v1.handlelanguagemodelslistrequest
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/language-models/{model-id}
      name: v1-language-models-model-id
      description: REST surface for v1-language-models-model_id.
      operations:
      - method: GET
        name: handlelanguagemodelgetrequest
        description: Get full information about a chat or image understanding model with its model_id.
        call: xai-v1.handlelanguagemodelgetrequest
        with:
          model_id: rest.model_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/messages
      name: v1-messages
      description: REST surface for v1-messages.
      operations:
      - method: POST
        name: handlegenericmessagesrequest
        description: Create a messages response. This endpoint is compatible with the Anthropic API.
        call: xai-v1.handlegenericmessagesrequest
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/models
      name: v1-models
      description: REST surface for v1-models.
      operations:
      - method: GET
        name: handlemodelslistrequest
        description: List all models available to the authenticating API key with minimalized information, including model
          names (ID), creation times, etc.
        call: xai-v1.handlemodelslistrequest
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/models/{model-id}
      name: v1-models-model-id
      description: REST surface for v1-models-model_id.
      operations:
      - method: GET
        name: handlemodelgetrequest
        description: Get minimalized information about a model with its model_id.
        call: xai-v1.handlemodelgetrequest
        with:
          model_id: rest.model_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/responses
      name: v1-responses
      description: REST surface for v1-responses.
      operations:
      - method: POST
        name: handlegenericmodelrequest
        description: Generates a response based on text or image prompts. The response ID can be used to retrieve the response
          later or to continue the conversation without repeating prior context. New responses will be stored for 30 days
          and then permanently d
        call: xai-v1.handlegenericmodelrequest
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/responses/{response-id}
      name: v1-responses-response-id
      description: REST surface for v1-responses-response_id.
      operations:
      - method: GET
        name: handlegetstoredcompletionrequest
        description: Retrieve a previously generated response.
        call: xai-v1.handlegetstoredcompletionrequest
        with:
          response_id: rest.response_id
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: handledeletestoredcompletionrequest
        description: Delete a previously generated response.
        call: xai-v1.handledeletestoredcompletionrequest
        with:
          response_id: rest.response_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/tokenize-text
      name: v1-tokenize-text
      description: REST surface for v1-tokenize-text.
      operations:
      - method: POST
        name: handletokenizetextrequest
        description: Tokenize text with the specified model
        call: xai-v1.handletokenizetextrequest
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/video-generation-models
      name: v1-video-generation-models
      description: REST surface for v1-video-generation-models.
      operations:
      - method: GET
        name: handlevideogenerationmodelslistrequest
        description: List all video generation models available to the authenticating API key with full information.
        call: xai-v1.handlevideogenerationmodelslistrequest
        output

# --- truncated at 32 KB (47 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/xai/refs/heads/main/capabilities/xai-v1.yaml