Skip to content

Quick Start

In just three steps, you can call the vast range of large models on Tianshu with your existing code.

Step 1: Sign up and create a key

  1. Open the Console and sign up (email verification required).
  2. Go to Token Management, click New, and generate an API key (looks like sk-xxxxxx).
  3. Keep this key safe — it is equivalent to your account credentials.

Step 2: Replace the base URL

Change the base URL (base_url / BASE_URL) in your client / SDK to Tianshu's standard route:

https://tian-shu.org

The full OpenAI-style Chat endpoint is therefore:

https://tian-shu.org/v1/chat/completions

For long-running requests such as image generation, use the direct route https://api.tian-shu.org instead. See Endpoints for details.

Step 3: Make your first request

cURL

bash
curl https://tian-shu.org/v1/chat/completions \
  -H "Authorization: Bearer $TIANSHU_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<pick a model from the Model Marketplace>",
    "messages": [{"role": "user", "content": "Hi, please introduce yourself"}]
  }'

Python (openai SDK)

python
from openai import OpenAI

client = OpenAI(
    api_key="your Tianshu key",
    base_url="https://tian-shu.org/v1",
)

resp = client.chat.completions.create(
    model="<pick a model from the Model Marketplace>",
    messages=[{"role": "user", "content": "Hi, please introduce yourself"}],
)
print(resp.choices[0].message.content)

Node.js (openai SDK)

js
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: process.env.TIANSHU_KEY,
  baseURL: 'https://tian-shu.org/v1',
});

const resp = await client.chat.completions.create({
  model: '<pick a model from the Model Marketplace>',
  messages: [{ role: 'user', content: 'Hi, please introduce yourself' }],
});
console.log(resp.choices[0].message.content);

Choosing a model

Put the name of the model you want to call in the model field. For all available models, their groups and live rates, check the Model Marketplace — just copy the model name to use it.

Next steps