UnderSky Docs

Terminal & curl

Discover models with GET /v1/models, call OpenAI-compatible endpoints with curl, stream responses, and use the Python SDK against api.undersky.ai.

Use standard HTTP tools against https://api.undersky.ai. Create API keys, top up credits, and manage your account in the Dashboard.

UnderSky CLI (account tools)

CLI distribution currently requires access to the private project repository. Use the curl or Python examples below to connect without repository access.

If you already have undersky-cli / usai installed, run diagnostics with:

undersky-cli doctor

To use undersky-cli upgrade, set GH_TOKEN (or GITHUB_TOKEN) with contents:read access to the project repository. Releases tagged cli-v* include Linux and macOS archives for x64 and arm64, with SHA256SUMS.

Set your API key

Store your model API key in the shell for repeatable examples:

export UNDERSKY_API_KEY="sk-your-api-key"

Never commit real API keys. Use Dashboard → Settings → API Keys to rotate compromised keys.

Discover models and endpoints

Public catalog endpoints do not require authentication:

curl -sS https://api.undersky.ai/v1/models | jq '.data[] | {id, owned_by}'
curl -sS https://api.undersky.ai/openapi.json | jq '.paths | keys[:10]'

Browse the full reference on undersky.ai/docs.

Chat completion

curl -sS https://api.undersky.ai/v1/chat/completions \
  -H "Authorization: Bearer $UNDERSKY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-luna",
    "messages": [{"role": "user", "content": "Hello!"}]
  }' | jq '.choices[0].message.content'

Streaming

curl -N https://api.undersky.ai/v1/chat/completions \
  -H "Authorization: Bearer $UNDERSKY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-luna",
    "stream": true,
    "messages": [{"role": "user", "content": "Count to three."}]
  }'

OpenAI SDK (Python)

pip install openai
from openai import OpenAI

client = OpenAI(
    api_key="sk-your-api-key",
    base_url="https://api.undersky.ai/v1",
)

response = client.chat.completions.create(
    model="gpt-6-luna",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)

Credits and usage

Account balance and usage history are available in Dashboard → Settings → Credit & Usage. Server integrations that already hold a scoped control token (usc_…) can query balance with:

curl -sS https://api.undersky.ai/api/v1/credits/balance \
  -H "Authorization: Bearer usc_your-control-token" | jq

Scripting tips

Pipe JSON through jq, capture HTTP status with -w "%{http_code}", and retry on 429 with backoff. Parse response bodies only; treat stderr from your shell separately from API error payloads.

On this page