OpenAI compatibility
Astrodyne provides an OpenAI-compatible Chat Completions API. Point an existing OpenAI client at the Astrodyne base URL with an Astrodyne key and keep your request and response handling unchanged for the documented scope.
Configuration
Python
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.astrodyne.ai/v1",
api_key=os.environ["ASTRODYNE_API_KEY"],
)
resp = client.chat.completions.create(
model="YOUR_MODEL_ID",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
JavaScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.astrodyne.ai/v1",
apiKey: process.env.ASTRODYNE_API_KEY,
});
const resp = await client.chat.completions.create({
model: "YOUR_MODEL_ID",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);
Currently supported
POST /v1/chat/completions— non-streaming and SSE streaming.GET /v1/models— the models your key can use.- Request fields:
model,messages,stream,temperature,top_p,max_tokens,max_completion_tokens,stop,presence_penalty,frequency_penalty,tools,tool_choice,response_format,seed,user. - OpenAI-shape responses, chunks, usage object, and error object.
Idempotency-Keyrequest header for safe retries of non-streaming requests (see Chat Completions).
Differences to know about
- Model names are Astrodyne canonical IDs. Use the IDs
returned by
/v1/modelsrather than assuming another vendor's catalog. - Unknown request fields are rejected with a
400naming the parameter, rather than silently ignored. - Request IDs: every response carries an
X-Astrodyne-Request-Idheader linking to the Request Explorer. - Streaming usage is not included in stream chunks; authoritative counts appear in the Request Explorer once the charge is final.
Not currently supported
- Endpoints other than the two above — completions (legacy), embeddings, images, audio, files, batches, and assistants are not available.
- Replaying an
Idempotency-Keyfor a streaming request.
Scope
"OpenAI-compatible" here means the Chat Completions and model-listing scope
documented on this page — not every endpoint of every OpenAI API version.