Skip to main content
Pinaivu authenticates every API request using an API key passed as a Bearer token in the Authorization header. No request will succeed without a valid key, so the first step before making any call is generating one in the dashboard.

Get your API key

1

Go to the dashboard

Visit api.pinaivu.com and sign in to your account.
2

Open API Keys

In the left-hand navigation, click API Keys.
3

Generate a new key

Click Generate. Your new key is displayed once — copy it immediately and store it in a safe place. All Pinaivu API keys begin with the prefix sk-pnv-.
sk-pnv-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Use your key in requests

Pass your API key in the Authorization header as a Bearer token on every request.
curl https://api.pinaivu.com/v1/chat/completions \
  -H "Authorization: Bearer sk-pnv-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama3.2:1b",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'
Because the gateway is OpenAI-compatible, you can also use the official OpenAI SDKs by pointing them at the Pinaivu base URL.
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["PINAIVU_API_KEY"],   # starts with sk-pnv-
    base_url="https://api.pinaivu.com/v1",
)

response = client.chat.completions.create(
    model="llama3.2:1b",
    messages=[{"role": "user", "content": "Hello!"}],
)

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

Keep your key secure

Your API key grants full access to your Pinaivu account. Follow these practices to protect it:
  • Never commit your key to version control. Add .env files to .gitignore and avoid hardcoding keys in source files.
  • Use environment variables. Reference your key via PINAIVU_API_KEY (or any name you choose) rather than inlining it in code.
  • Rotate immediately if compromised. If you suspect a key has been exposed, return to the API Keys section of the dashboard and revoke it, then generate a new one.
  • Grant least privilege. If you are building a multi-user product, use separate keys per environment (development, staging, production) so a leaked key limits blast radius.
Never share your API key publicly or commit it to source code. If your key is exposed in a repository or log file, revoke it from the dashboard immediately and generate a replacement.

Authentication errors

StatusMeaningResolution
401 UnauthorizedThe Authorization header is missing or the key is malformed.Ensure your request includes Authorization: Bearer sk-pnv-... with a valid key.
403 ForbiddenThe key is valid but does not have permission to perform this action, or the key has been revoked.Check that the key is active in the dashboard. Revoked keys must be replaced with a new one.
429 Too Many RequestsYou have exceeded your rate limit or usage quota.Wait for the rate-limit window to reset, or review your plan limits in the dashboard.