example.mjs. Read the API key from an environment variable. Do not expose it in browser JavaScript.
instructions field. Check the model catalog for supported model IDs and reasoning support.
The SDK returns the standard Chat Completions shape. Read the generated text from choices[0].message.content and usage data from response.usage.
If the request fails, check the API key, organization balance, model ID, and system prompt first. For endpoint-specific fields, see the Chat Completions reference.
