← All AI API providers

DEVELOPER FIELD NOTES / DOCS CHECKED 2026-09-23

OpenAI
API endpoint & setup.

Use the Responses API for this example. Keep /v1 in the base URL; the SDK appends /responses.

SDK base URL

https://api.openai.com/v1

Full request endpoint · POST

https://api.openai.com/v1/responses

Read the official OpenAI documentation ↗ · Checked 2026-09-23; no live API call made.

A small starting point.

Install the library shown below. Set AI_MODEL to a model available to your account and OPENAI_API_KEY to your key. In cURL, replace YOUR_MODEL_ID. Replace any workspace placeholders before running.

Python

# pip install openai
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["OPENAI_API_KEY"],
    base_url="https://api.openai.com/v1",
)
response = client.responses.create(
    model=os.environ["AI_MODEL"], input="Hello!"
)
print(response)

Node.js

// npm install openai
// Server-side Node.js; never expose API keys in a browser.
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,
  baseURL: "https://api.openai.com/v1",
});
const response = await client.responses.create({
  "model": process.env.AI_MODEL,
  "input": "Hello!"
});
console.log(response);

cURL

curl 'https://api.openai.com/v1/responses' \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "YOUR_MODEL_ID",
  "input": "Hello!"
}'

Before moving this into production.

Check model availability, billing, rate limits and supported parameters in the provider documentation. Start with a small request from your backend. Keep keys out of client-side JavaScript and source control.

These examples show the request shape and configuration. They do not test your credentials or guarantee access to a model.

Compare other AI API endpoints →