API key

Build

Migrating from OpenAI

Change the base URL, the key and the model id. What stays the same, and the few things to check.

The change

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://sovereign.paranine.com/v1",   # was api.openai.com
    api_key=os.environ["P9_API_KEY"],                # sk_p9_… instead of sk-…
)

client.chat.completions.create(
    model="paranine/gpt-oss-120b(Global)",           # a Paranine model id
    messages=[{"role": "user", "content": "Hello"}],
)

Frameworks that wrap the OpenAI client (LangChain, LlamaIndex, the Vercel AI SDK's OpenAI-compatible provider and most agent toolkits) take the same two settings, usually as base_url or baseURL and api_key.

What stays the same

  • Chat completions requests and responses: messages, stream, max_tokens, temperature, tools, usage, finish_reason.
  • Streaming as server-sent events ending in data: [DONE].
  • Embeddings on /v1/embeddings.
  • The error envelope (message, type, code, param) and what 401, 429 and 5xx mean.

What to check

AreaOn Paranine
Model namesUse Paranine model ids from the catalogue, verbatim. There is no gpt-4o: pick the open-weight model that fits.
Parametersn must be 1. Parameters outside OpenAI's chat completions API are refused with 400 rather than ignored.
Reply lengthWithout max_tokens, replies are capped at the model's default length. Set max_tokens when you expect long answers.
Balance errors402 when your balance or the key's credit cap can't cover a request. OpenAI has no equivalent: handle it explicitly.
Rate limits60 requests per minute per key by default, adjustable per key. A model at capacity answers 429 whichever key you use.
models.list()Not available yet (404). Keep the model id in configuration.
Not availableImages, files, assistants, /v1/completions and /v1/responses.

A safe rollout

  1. Create a key with a credit cap, and with allowed models set to the one model you're moving to, so the trial can't overspend.
  2. Point a staging deployment at Paranine with that key, and compare output and latency in the request logs.
  3. Move production to its own key and cap, so its spend and errors show on a line of their own.

Further reading

Something unclear or wrong on this page? Tell us. Machine-readable copies: llms.txt.