Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OriginStartAI OpenAI-Compatible API Examples

Copyable curl, Python, and Node.js examples for testing OriginStartAI with familiar OpenAI-compatible API patterns.

Use this repo when you want to confirm one chat completion, stream tokens, request JSON output, or migrate a small existing OpenAI-style call.

30-Second First Call

  1. Create an account: https://originstartai.com?utm_source=github&utm_medium=repo&utm_campaign=openai_compatible_examples
  2. Create an API key in the OriginStartAI console.
  3. Copy .env.example to .env.
  4. Set ORIGINSTARTAI_API_KEY, ORIGINSTARTAI_BASE_URL, and ORIGINSTARTAI_MODEL.
  5. Run the smallest example:
bash examples/curl/chat_completion.sh
python examples/python/chat_completion.py
node examples/node/chat_completion.mjs

New user bonus: after your first call works, recharge $5 and get $5 extra API credits to test a real workflow.

What Is Included

Goal curl Python Node.js
Chat completion examples/curl/chat_completion.sh examples/python/chat_completion.py examples/node/chat_completion.mjs
Streaming - examples/python/streaming.py examples/node/streaming.mjs
JSON output - examples/python/json_output.py examples/node/json_output.mjs
Timeout + retry - examples/python/retry_timeout.py examples/node/retry_timeout.mjs

Migration Pattern

Most OpenAI-compatible migrations start with three changes:

baseURL/base_url -> OriginStartAI API base URL
apiKey/api_key   -> OriginStartAI API key
model            -> enabled model on your OriginStartAI account

Keep your prompt, response parsing, and application logic the same for the first test. Once the first call works, add retries, timeout handling, and logging before moving production traffic.

For a copyable production-style retry pattern, see:

python examples/python/retry_timeout.py
node examples/node/retry_timeout.mjs

Production Trust Checks

After the examples run, use the companion trust assets before moving production traffic:

This gives developers a clean funnel: first call, migration, cost estimate, benchmark, health check, then production rollout.

Local Syntax Check

Before copying the examples into a project, you can run a no-key syntax check:

python scripts/check_examples_syntax.py

The check does not call the API and does not read .env; it only verifies the Python examples compile and Node.js examples parse.

If The First Call Fails

Symptom Check
401 Unauthorized Confirm the API key in .env is current and has no extra spaces.
insufficient credits Recharge in the OriginStartAI console, then retry the same example.
model not found Copy the enabled model name from the console into ORIGINSTARTAI_MODEL.
Slow response Test streaming, shorten the prompt, and set explicit request timeouts.

Docs

Search Topics

  • OpenAI-compatible API examples.
  • Chat completions API example.
  • Streaming chat completions.
  • JSON structured output LLM.
  • Python AI API example.
  • Node.js AI API example.

Links

About

Curl, Python, and Node.js examples for OpenAI-compatible API chat completions, streaming, and JSON output.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages