cd /news/developer-tools/how-to-run-your-first-openai-compati… · home topics developer-tools article
[ARTICLE · art-59863] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=· neutral

How to run your first OpenAI-compatible API call with curl, Python, and Node.js

OriginStartAI released an open-source repository with curl, Python, and Node.js examples for making the first OpenAI-compatible API call. The repo covers streaming, JSON structured output, migration notes, and common errors like 401 Unauthorized and model not found. Developers can test their endpoint, key, and model configuration with a minimal request before integrating into production workflows.

read2 min views1 publishedJul 15, 2026

When you are testing an OpenAI-compatible API endpoint, the fastest path is not to wire it into a full app immediately. Start with one small request, confirm the base URL, API key, model name, and response shape, then move the working call into your product.

I put together a compact examples repo for that exact first-call workflow:

https://github.com/OriginStartAI/openai-compatible-api-examples

It includes curl, Python, Node.js, streaming responses, JSON structured output, migration notes, and a small error reference.

Keep credentials out of source code and use environment variables:

ORIGINSTARTAI_API_KEY=your_api_key_here
ORIGINSTARTAI_BASE_URL=https://your-api-base-url/v1
ORIGINSTARTAI_MODEL=your_enabled_model

The important parts are simple:

base_url

or baseURL

points to your OpenAI-compatible endpoint.api_key

or apiKey

is your provider key.model

must be enabled for your account.Curl is useful because it removes SDK behavior from the equation:

curl "$ORIGINSTARTAI_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $ORIGINSTARTAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "'"$ORIGINSTARTAI_MODEL"'",
    "messages": [
      {"role": "user", "content": "Say hello from OriginStartAI"}
    ]
  }'

If this works, your endpoint, key, and model are probably configured correctly.

from openai import OpenAI
import os

client = OpenAI(
    api_key=os.environ["ORIGINSTARTAI_API_KEY"],
    base_url=os.environ["ORIGINSTARTAI_BASE_URL"],
)

response = client.chat.completions.create(
    model=os.environ["ORIGINSTARTAI_MODEL"],
    messages=[{"role": "user", "content": "Write one friendly onboarding sentence."}],
)

print(response.choices[0].message.content)
python
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.ORIGINSTARTAI_API_KEY,
  baseURL: process.env.ORIGINSTARTAI_BASE_URL,
});

const response = await client.chat.completions.create({
  model: process.env.ORIGINSTARTAI_MODEL,
  messages: [{ role: "user", content: "Write one friendly onboarding sentence." }],
});

console.log(response.choices[0].message.content);

401 Unauthorized

: the key is missing, expired, or copied incorrectly.model not found

: the model name is not enabled for the account.insufficient credits

: add API balance before testing more requests.Once the first call works, replace the sample prompt with one real workflow from your product: support replies, summaries, SEO outlines, structured JSON extraction, or internal automation.

Repo:

https://github.com/OriginStartAI/openai-compatible-api-examples

Start here:

https://originstartai.com?utm_source=github&utm_medium=community&utm_campaign=openai_compatible_examples

New user offer: recharge $5 and get $5 extra API credits.

── more in #developer-tools 4 stories · sorted by recency
── more on @originstartai 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-run-your-firs…] indexed:0 read:2min 2026-07-15 ·