OpenAI SDK
Use Prismatic with the official OpenAI JavaScript and Python SDKs by overriding the base URL.
Configuration
- Install the official
openaipackage in your application. - Set
PRISMATIC_API_KEYserver-side and map it toOPENAI_API_KEYif the SDK expects that variable. - Set the SDK
baseURL/base_urltohttps://api.prismaticapi.com/v1. - Use any public model ID returned by
GET /v1/models.
Example
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.PRISMATIC_API_KEY,
baseURL: "https://api.prismaticapi.com/v1"
});
const completion = await client.chat.completions.create({
model: "claude-sonnet-4-6",
messages: [{ role: "user", content: "Write three product taglines." }],
max_tokens: 400
});import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["PRISMATIC_API_KEY"],
base_url="https://api.prismaticapi.com/v1",
)
completion = client.chat.completions.create(
model="claude-sonnet-4-6",
messages=[{"role": "user", "content": "Write three product taglines."}],
max_tokens=400,
)Recommended models
claude-sonnet-4-6— strong model for reasoning, refactors and coding agents.claude-haiku-4-5— fast option for autocomplete, small questions and lightweight tasks.deepseek-v3-2or another public ID — alternative based on your active catalog and plan.
Troubleshooting
Authentication error
Check that the API key has no extra spaces and has not been revoked in the dashboard.
Model rejected
Use a public model ID returned by GET /v1/models; do not use labels or aliases.
Connection issue
Confirm the configured base URL is exactly the one shown above and that your network allows HTTPS to api.prismaticapi.com.
Notes
/v1/chat/completions,/v1/responsesand/v1/modelsuse the OpenAI-compatible surface.- Keep the key out of browser code and mobile clients.
- Streaming works when the SDK request sets
stream: true.