Authentication
Every Starmodel endpoint requires an API key, passed in the Authorization request header.
Get an API key
- Open the API Keys page — Sign in to the Starmodel console and open the API Keys page.
- Generate a new key — Click New key. The full key string (
sk-…) is shown exactly once — copy it to a secret store immediately. - Name and manage the key — Add a description so you remember what the key is for. You can disable, re-enable, or delete any key at any time from the same page.
The full key is shown only once, at creation. If you lose it you cannot recover it — disable the old key and generate a new one.
Send authenticated requests
Include the key as a Bearer token in the Authorization header:
Authorization: Bearer <API Key>A minimal request:
curl https://api.starmodel.ai/v1/chat/completions \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "your model ID", "messages": [ { "role": "user", "content": "Hello" } ] }'The same header works for every endpoint — chat, images, video, speech, and GET /v1/models.
SDK setup
Most OpenAI-compatible SDKs accept a base_url override. Point it at Starmodel and pass your key:
from openai import OpenAIclient = OpenAI( api_key=os.environ["API_KEY"], base_url="https://api.starmodel.ai/v1",)import OpenAI from "openai";const client = new OpenAI({ apiKey: process.env.API_KEY, baseURL: "https://api.starmodel.ai/v1",});Best practices
- Never commit keys to source control. Use environment variables, gitignored
.envfiles, or a secret manager. - Rotate regularly. Generate a new key and disable the old one when a teammate leaves, when you suspect a leak, or on a fixed cadence.
- One key per workload. Per-service keys make leaks easy to scope and disable without disrupting unrelated traffic.
- Server-side only. Treat the key like a database password — never ship it in a browser bundle or mobile app.
Errors
Authentication failures return a JSON error body:
{ "error": { "code": "unauthorized", "message": "unauthorized", "type": "error" }}Status codes:
| Status | Meaning |
|---|---|
401 | Missing or invalid API key. |
403 | The key is disabled, or has no access to the requested resource. |
429 | Rate limit exceeded — retry after the delay in the Retry-After header. |

