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.
- Create an account: https://originstartai.com?utm_source=github&utm_medium=repo&utm_campaign=openai_compatible_examples
- Create an API key in the OriginStartAI console.
- Copy
.env.exampleto.env. - Set
ORIGINSTARTAI_API_KEY,ORIGINSTARTAI_BASE_URL, andORIGINSTARTAI_MODEL. - Run the smallest example:
bash examples/curl/chat_completion.shpython examples/python/chat_completion.pynode examples/node/chat_completion.mjsNew user bonus: after your first call works, recharge $5 and get $5 extra API credits to test a real workflow.
| 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 |
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.pynode examples/node/retry_timeout.mjsAfter the examples run, use the companion trust assets before moving production traffic:
- Estimate monthly spend with
ai-api-cost-calculator. - Measure latency and success rate with
ai-gateway-benchmark. - Add a lightweight health check with
originstart-status-examples.
This gives developers a clean funnel: first call, migration, cost estimate, benchmark, health check, then production rollout.
Before copying the examples into a project, you can run a no-key syntax check:
python scripts/check_examples_syntax.pyThe check does not call the API and does not read .env; it only verifies the Python examples compile and Node.js examples parse.
| 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. |
- OpenAI-compatible API examples.
- Chat completions API example.
- Streaming chat completions.
- JSON structured output LLM.
- Python AI API example.
- Node.js AI API example.