Table of contents

Quickstart

Make your first call to the Podstack Inference Cloud. You will get an API key, list the available models, and send a chat completion with curl, the OpenAI Python SDK, and the OpenAI Node.js SDK — all against the real endpoint.

Prerequisites

  • A Podstack account with a funded wallet (inference is billed per token; a request with a zero balance returns 402 insufficient_funds).
  • The endpoint base URL: https://cloud.podstack.ai/infer/v1

Step 1 — Create an API key

  1. Open the Podstack Inference portal and go to API Keys.
  2. Click Create API Key, give it a name (e.g. dev-laptop), and pick an expiry.
  3. Copy the key immediately — it’s shown only once. Keys start with psk_.

Store it as an environment variable so you never hardcode it:

export PODSTACK_API_KEY="psk_xxxxxxxxxxxxxxxxxxxx"

See Authentication for key limits, rotation, and revocation.

Step 2 — Find a model ID

The catalog is managed per deployment, so model IDs are not fixed — list them before you hardcode one.

From the terminal with the CLI:

podstack models list
NAME                    CONTEXT   ID
...                     ...       ...

Or over HTTP:

curl https://cloud.podstack.ai/infer/v1/models \
  -H "Authorization: Bearer $PODSTACK_API_KEY"

Pick an id from the output and use it as the model value below. In the examples we write it as <MODEL_ID>.

Step 3 — Send your first request

curl

curl https://cloud.podstack.ai/infer/v1/chat/completions \
  -H "Authorization: Bearer $PODSTACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<MODEL_ID>",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

OpenAI Python SDK

pip install openai
from openai import OpenAI

client = OpenAI(
    base_url="https://cloud.podstack.ai/infer/v1",
    api_key="PODSTACK_API_KEY",  # or read os.environ["PODSTACK_API_KEY"]
)

resp = client.chat.completions.create(
    model="<MODEL_ID>",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Explain quantum computing in one sentence."},
    ],
    temperature=0.7,
    max_tokens=500,
)

print(resp.choices[0].message.content)

OpenAI Node.js SDK

npm install openai
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://cloud.podstack.ai/infer/v1",
  apiKey: process.env.PODSTACK_API_KEY,
});

const resp = await client.chat.completions.create({
  model: "<MODEL_ID>",
  messages: [{ role: "user", content: "Hello" }],
});

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

Step 4 — Stream the response

Set stream: true to receive tokens as they are generated (Server-Sent Events under the hood):

stream = client.chat.completions.create(
    model="<MODEL_ID>",
    messages=[{"role": "user", "content": "Write a haiku about GPUs."}],
    stream=True,
)
for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="", flush=True)

Step 5 — Check your usage

Every request is metered and billed from your wallet. See per-key request counts, token totals, and cost under Inference > Usage in the portal, or read Pricing & Usage.

Next steps

  • API Reference — every supported route, parameter, and error code.
  • Models — browse and filter the catalog.
  • Playground — try a model in the browser first.