Docs
Getting started

Quickstart

Get an API key, make your first chat completion in curl, JavaScript, or Python, and switch to streaming.

This guide takes you from zero to a working chat completion. You need an API key, any HTTP client, and about five minutes.

  1. 1

    Get an API key

    Create a key in your Tase dashboard. Keys start with tase_sk_ and are shown once at creation — store it somewhere safe.
  2. 2

    Make your first request

    Send a POST to https://api.tase.app/v1/chat/completions with your key in the Authorization header and tase-8b as the model.
  3. 3

    Read the response

    The assistant message is at choices[0].message.content. Token counts are in usage.
  4. 4

    Switch to streaming

    Add "stream": true to receive the response token by token over server-sent events.

1. Get an API key

Create an API key from your Tase dashboard. Export it as an environment variable so the examples below work as-is:

export TASE_API_KEY="tase_sk_your_key_here"

Keep the key server-side

Never ship an API key in a browser bundle or a mobile app. Call the API from your backend and pass results to your client.

2. Make your first request

curl

curl https://api.tase.app/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TASE_API_KEY" \
  -d '{
    "model": "tase-8b",
    "messages": [
      { "role": "system", "content": "You are a concise assistant." },
      { "role": "user", "content": "Give me a one-line productivity tip." }
    ]
  }'

JavaScript

const response = await fetch('https://api.tase.app/v1/chat/completions', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: 'Bearer ' + process.env.TASE_API_KEY,
  },
  body: JSON.stringify({
    model: 'tase-8b',
    messages: [
      { role: 'system', content: 'You are a concise assistant.' },
      { role: 'user', content: 'Give me a one-line productivity tip.' },
    ],
  }),
});

const data = await response.json();
console.log(data.choices[0].message.content);

Python

import os
import requests

response = requests.post(
    "https://api.tase.app/v1/chat/completions",
    headers={"Authorization": "Bearer " + os.environ["TASE_API_KEY"]},
    json={
        "model": "tase-8b",
        "messages": [
            {"role": "system", "content": "You are a concise assistant."},
            {"role": "user", "content": "Give me a one-line productivity tip."},
        ],
    },
)

data = response.json()
print(data["choices"][0]["message"]["content"])

3. Read the response

A successful request returns a chat completion object. The text you want is choices[0].message.content:

{
  "id": "chatcmpl-9f2c1a7e",
  "object": "chat.completion",
  "created": 1753056000,
  "model": "tase-8b",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Do the hardest task first, before you open anything else."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 27,
    "completion_tokens": 13,
    "total_tokens": 40
  }
}

4. Stream the response

For chat interfaces you usually want output as it is generated. Set "stream": true and the API responds with server-sent events. Each event carries a delta with the next piece of content:

curl https://api.tase.app/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TASE_API_KEY" \
  -d '{
    "model": "tase-8b",
    "stream": true,
    "messages": [
      { "role": "user", "content": "Count from one to five." }
    ]
  }'
data: {"id":"chatcmpl-9f2c1a7e","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"role":"assistant","content":"One"}}]}

data: {"id":"chatcmpl-9f2c1a7e","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":", two"}}]}

data: {"id":"chatcmpl-9f2c1a7e","object":"chat.completion.chunk","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]

Concatenate the delta.content values in order to rebuild the full message. The stream ends with a data: [DONE] event.

Where next

Add tools to your requests with function calling, or see every parameter in the API reference.