Light Logo

Quickstart

This quickstart will walk you through running your first model with WriftAI

Create an Access Token

WriftAI uses access tokens to authenticate API calls and CLI commands.

  1. Open the Access Tokens page in your dashboard
  2. Create a new token and copy it somewhere safe — you’ll need it in the next step.

Set Your Access Token

Export your access token as an environment variable:

export WRIFTAI_ACCESS_TOKEN="YOUR_TOKEN_HERE"

If you're using the WriftAI CLI, you can alternatively log in interactively:

wriftai auth login --token YOUR_TOKEN_HERE

Run a Model in the Cloud

WriftAI can execute models in the cloud with no local setup required. Cloud runtimes automatically scale based on demand, making it ideal for production workloads or environments without GPUs.

To run deepseek-ai/deepseek-r1 in the cloud:

First, install the wriftai python library

pip install wriftai

Then make a request

from wriftai import Client

# Instantiate the WriftAI client
wriftai = Client()

# Create a prediction against deepseek-ai/deepseek-r1 and wait for it to complete
prediction = wriftai.predictions.create(
    model="deepseek-ai/deepseek-r1",
    params={
        "input": {
            "prompt": "Summarize quantum computing.",
        }
    },
    wait=True,
)

print(prediction.output)
# Quantum computing uses quantum bits to solve problems...

First, install the wriftai library

npm install wriftai

Then make a request

import { WriftAI } from 'wriftai';

// Instantiate the WriftAI client
const wriftai = new WriftAI();

// Create a prediction against deepseek-ai/deepseek-r1 and wait for it to complete
const prediction = await wriftai.predictions.create(
  {
    model: 'deepseek-ai/deepseek-r1',
    input: {
      prompt: 'Summarize quantum computing.',
    },
  },
  true, // wait for completion
);

console.log(prediction.output);
// Quantum computing uses quantum bits to solve problems...

First install the package

go get -u github.com/wriftai/wriftai-go

Then make a request

import (
	"context"
	"encoding/json"
	"fmt"
	"log"

	"github.com/wriftai/wriftai-go"
)

func main() {
	// Instantiate the WriftAI client
	client := wriftai.NewClient()

	// Create a prediction against deepseek-ai/deepseek-r1 and wait for it to complete
	prediction, err := client.Predictions.CreateWithModel(
		context.TODO(),
		"deepseek-ai/deepseek-r1",
		wriftai.CreatePredictionParams{
			Input: json.RawMessage(`{"prompt":"Summarize quantum computing."}`),
		},
		true, // wait for completion
		nil,  // use default wait options
	)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Print(string(prediction.Output))
	// Quantum computing uses quantum bits to solve problems...
}

Install the WriftAI CLI, if you haven't, and make a request

# Create a prediction against deepseek-ai/deepseek-r1 and wait for it to complete
wriftai predictions create \
   --model deepseek-ai/deepseek-r1 \
   --input '{"prompt": "Summarize quantum computing."}' \
   --wait
# Create a prediction
response=$(
  curl -s -X POST "https://api.wrift.ai/v1/models/deepseek-ai/deepseek-r1/predictions" \
    -H "Authorization: Bearer $WRIFTAI_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "input": {
        "prompt": "Summarize quantum computing in one simple sentence."
      }
    }'
)

# Extract prediction ID
prediction_id=$(echo "$response" | jq -r '.id')

# Poll until status is 'succeeded' or 'failed'
status="pending"
while [[ "$status" != "succeeded" && "$status" != "failed" ]]; do
  sleep 2
  poll_response=$(
    curl -s "https://api.wrift.ai/v1/predictions/$prediction_id" \
      -H "Authorization: Bearer $WRIFTAI_ACCESS_TOKEN"
  )
  status=$(echo "$poll_response" | jq -r '.status')
done

# Print the output
echo "$poll_response" | jq -r '.output'
# Quantum computing uses quantum bits to solve problems...

Run a Model Locally

You can run models directly on your machine using the WriftAI CLI.

To run deepseek-ai/deepseek-r1 locally:

wriftai model run deepseek-ai/deepseek-r1

This command pulls the model and starts serving it locally.

To generate a prediction:

wriftai model predict prompt="Summarize quantum computing."

You should receive a generated summary in your terminal — congratulations, you've run your first model locally with WriftAI!