{"slug": "how-to-run-your-first-openai-compatible-api-call-with-curl-python-and-node-js", "title": "How to run your first OpenAI-compatible API call with curl, Python, and Node.js", "summary": "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.", "body_md": "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.\n\nI put together a compact examples repo for that exact first-call workflow:\n\n[https://github.com/OriginStartAI/openai-compatible-api-examples](https://github.com/OriginStartAI/openai-compatible-api-examples)\n\nIt includes curl, Python, Node.js, streaming responses, JSON structured output, migration notes, and a small error reference.\n\nKeep credentials out of source code and use environment variables:\n\n```\nORIGINSTARTAI_API_KEY=your_api_key_here\nORIGINSTARTAI_BASE_URL=https://your-api-base-url/v1\nORIGINSTARTAI_MODEL=your_enabled_model\n```\n\nThe important parts are simple:\n\n`base_url`\n\nor `baseURL`\n\npoints to your OpenAI-compatible endpoint.`api_key`\n\nor `apiKey`\n\nis your provider key.`model`\n\nmust be enabled for your account.Curl is useful because it removes SDK behavior from the equation:\n\n```\ncurl \"$ORIGINSTARTAI_BASE_URL/chat/completions\" \\\n  -H \"Authorization: Bearer $ORIGINSTARTAI_API_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"model\": \"'\"$ORIGINSTARTAI_MODEL\"'\",\n    \"messages\": [\n      {\"role\": \"user\", \"content\": \"Say hello from OriginStartAI\"}\n    ]\n  }'\n```\n\nIf this works, your endpoint, key, and model are probably configured correctly.\n\n``` python\nfrom openai import OpenAI\nimport os\n\nclient = OpenAI(\n    api_key=os.environ[\"ORIGINSTARTAI_API_KEY\"],\n    base_url=os.environ[\"ORIGINSTARTAI_BASE_URL\"],\n)\n\nresponse = client.chat.completions.create(\n    model=os.environ[\"ORIGINSTARTAI_MODEL\"],\n    messages=[{\"role\": \"user\", \"content\": \"Write one friendly onboarding sentence.\"}],\n)\n\nprint(response.choices[0].message.content)\npython\nimport OpenAI from \"openai\";\n\nconst client = new OpenAI({\n  apiKey: process.env.ORIGINSTARTAI_API_KEY,\n  baseURL: process.env.ORIGINSTARTAI_BASE_URL,\n});\n\nconst response = await client.chat.completions.create({\n  model: process.env.ORIGINSTARTAI_MODEL,\n  messages: [{ role: \"user\", content: \"Write one friendly onboarding sentence.\" }],\n});\n\nconsole.log(response.choices[0].message.content);\n```\n\n`401 Unauthorized`\n\n: the key is missing, expired, or copied incorrectly.`model not found`\n\n: the model name is not enabled for the account.`insufficient credits`\n\n: 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.\n\nRepo:\n\n[https://github.com/OriginStartAI/openai-compatible-api-examples](https://github.com/OriginStartAI/openai-compatible-api-examples)\n\nStart here:\n\n[https://originstartai.com?utm_source=github&utm_medium=community&utm_campaign=openai_compatible_examples](https://originstartai.com?utm_source=github&utm_medium=community&utm_campaign=openai_compatible_examples)\n\nNew user offer: recharge $5 and get $5 extra API credits.", "url": "https://wpnews.pro/news/how-to-run-your-first-openai-compatible-api-call-with-curl-python-and-node-js", "canonical_source": "https://dev.to/originstartai/how-to-run-your-first-openai-compatible-api-call-with-curl-python-and-nodejs-2mgi", "published_at": "2026-07-15 03:51:24+00:00", "updated_at": "2026-07-15 03:56:41.096305+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "large-language-models"], "entities": ["OriginStartAI", "OpenAI"], "alternates": {"html": "https://wpnews.pro/news/how-to-run-your-first-openai-compatible-api-call-with-curl-python-and-node-js", "markdown": "https://wpnews.pro/news/how-to-run-your-first-openai-compatible-api-call-with-curl-python-and-node-js.md", "text": "https://wpnews.pro/news/how-to-run-your-first-openai-compatible-api-call-with-curl-python-and-node-js.txt", "jsonld": "https://wpnews.pro/news/how-to-run-your-first-openai-compatible-api-call-with-curl-python-and-node-js.jsonld"}}