Send your first request
One endpoint, one key, one model id.
The request
curl
curl https://api.astrodyne.ai/v1/chat/completions \
-H "Authorization: Bearer $ASTRODYNE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "astrodyne-staging-echo",
"messages": [{"role": "user", "content": "Hello"}]
}'
In Python
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="astrodyne-staging-echo",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
In JavaScript / TypeScript
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: "astrodyne-staging-echo",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);
About the model id
astrodyne-staging-echo is a real model id. Confirm your account can
call it with GET /v1/models before relying on it in code.
What comes back
A standard Chat Completion object: id, object,
created, model, choices and
usage. Every response also carries an
X-Astrodyne-Request-Id header whose value starts with
req- — keep it, it is how you look the request up later.
Then check what it cost
Open Requests, paste the request id, and you will see the model, the token counts, the latency and the exact charge.