xAI API guide
x.ai
Explore available xAI models, estimate token costs, generate responses from text or images, and create images from prompts.
Actions and inputs
model-pickerRecommend available models for a specific task.
Inputs task
cost-previewEstimate the cost of input and output tokens.
Inputs model or task, input token count, output token count
responses handle-generic-model-requestGenerate a response from text or image input.
Inputs model, text or image input
images handle-generate-requestGenerate an image from a text prompt.
Inputs model, prompt
xAI team file
- Create
Upload a file to your xAI team's storage.
Inputs file, optional expiration
- Read
Retrieve metadata for your team's uploaded file.
Inputs file ID
- Update
Replace your team's file by uploading the revised version, then deleting the old one.
Inputs old file ID, revised file
- Delete
Delete a file from your xAI team's storage.
Inputs file ID