Skip to content
tenvoralpha
GuidesFirst request

Documentation · Start

Your first request

Five steps from a new account to a reply and its receipt. You need an account and somewhere to run Python, Node or curl.

Step 1: Sign up

Use Sign up on tenvor.io. No card is needed, and a new account starts with $0.25 of free credit.

Then sign in to the Console. It is where you create keys and read your usage.

Step 2: Create an API key

In the Console, open API keys and choose Create key. Tenvor may ask you to verify it is you again before it creates, replaces or revokes a key.

The key starts with sk-dc-. It is shown once, and Tenvor cannot show it again. Copy it into a password manager or your secret store before you close the page.

Your account has one key. If you lose it or it leaks, replace it: the old key stops working at once, and the new one is shown once.

Treat it like a password

A key can spend your balance. Keep it out of source code, URLs, screenshots and chat messages.

Step 3: Set your key and change the base URL

Put the key in an environment variable named TENVOR_API_KEY. Your code reads it from there, so the key never has to be written into a file.

Set the key in your shell
Terminal
export TENVOR_API_KEY="sk-dc-…"

PowerShell
$env:TENVOR_API_KEY = "sk-dc-…"

Replace sk-dc-… with your key. The variable lasts for this terminal window.

Then point your OpenAI client at Tenvor. You keep the SDK. You change the base URL, the key and the model id.

Base URL
https://orchestrator.tenvor.io/v1
Key
sk-dc-…, read from TENVOR_API_KEY
Model id
chat-35b-moe

Step 4: Send one request

Install the SDK first: pip install openai for Python, or npm install openai for Node. Then run the sample. The highlighted line is the one that sends your request to Tenvor.

Your first request, in Python, Node or curl
hello.pychange the base URL
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://orchestrator.tenvor.io/v1",
    api_key=os.environ["TENVOR_API_KEY"],
)

reply = client.chat.completions.create(
    model="chat-35b-moe",
    messages=[{"role": "user", "content": "Say hello in one line."}],
)

print(reply.choices[0].message.content)
print(reply.usage)

hello.mjschange the base URL
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://orchestrator.tenvor.io/v1",
  apiKey: process.env.TENVOR_API_KEY,
});

const reply = await client.chat.completions.create({
  model: "chat-35b-moe",
  messages: [{ role: "user", content: "Say hello in one line." }],
});

console.log(reply.choices[0].message.content);
console.log(reply.usage);

Terminalchange the base URL
curl https://orchestrator.tenvor.io/v1/chat/completions \
  -H "Authorization: Bearer $TENVOR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "chat-35b-moe",
    "messages": [{"role": "user", "content": "Say hello in one line."}]
  }'

The curl sample is for a Bash shell: macOS, Linux or Git Bash. In Windows PowerShell, curl is a different command, so use the Python or Node sample there.

Prefer streaming for long replies. Without streaming the server waits up to 4,100 seconds, then allows 10 seconds to write the result. If delivery breaks, fetch the stored result with X-Request-Id or the same Idempotency-Key.

Step 5: Read the response and its receipt

The reply is in choices[0].message.content. Beside it are two blocks of numbers. usage counts tokens (roughly, pieces of words). billing is the itemised receipt for this request.

What comes backsample, abridged200 OK
{
  "id": "chatcmpl-…",
  "object": "chat.completion",
  "model": "chat-35b-moe",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you today?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 14,
    "completion_tokens": 9,
    "total_tokens": 23
  },
  "billing": {
    "full_input_tokens": 14,
    "cached_input_tokens": 0,
    "output_tokens": 9,
    "charged_micro_usd": …
  }
}
The receipt: the billing object of the response above
full_input_tokens14Tokens you sent, at the full input rate.
cached_input_tokens0Input tokens billed at the cached rate, half the full input rate. It reads 0 on a first request and on any request that did not ask for reuse.
output_tokens9Tokens in the reply.
charged_micro_usd…What you are charged, in millionths of a dollar: 1,000,000 is $1. The rates are on Pricing.

You pay per token, for what goes in and what comes out. For each request you pay the larger of the tokens you used or the minimum per request. The rates and the minimum are on Pricing.

Your SDK may hide fields it does not know about. To see the whole body, use curl, or ask your SDK for the raw response. The Usage page in the Console lists the same charge.

Streaming changes where the receipt is

A streamed response ends with token usage if you ask for it. Its itemised receipt is at GET /v1/results/{id}, where the id is the X-Request-Id response header.

Where to go next

Content checked . Live limits and prices can change.