{"id":6675,"date":"2026-08-21T10:12:09","date_gmt":"2026-08-21T08:12:09","guid":{"rendered":"https:\/\/www.hostx.ro\/kb\/"},"modified":"2026-08-21T10:12:26","modified_gmt":"2026-08-21T08:12:26","password":"","slug":"cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai","status":"publish","type":"docs","link":"https:\/\/www.hostx.ro\/kb\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\/","title":{"rendered":"Cum folosesc API-ul Ollama (REST \u0219i endpoint compatibil OpenAI)?"},"content":{"rendered":"<p>Pe l\u00e2ng\u0103 linia de comand\u0103, Ollama expune un <strong>API local<\/strong> pe portul <strong>11434<\/strong>, cu care alte aplica\u021bii pot folosi modelele. Are at\u00e2t un API propriu, c\u00e2t \u0219i un endpoint <strong>compatibil OpenAI<\/strong>.<\/p>\n<h2>Generarea de text (\/api\/generate)<\/h2>\n<pre><code>curl http:\/\/127.0.0.1:11434\/api\/generate -d '{\r\n  \"model\": \"llama3.1\",\r\n  \"prompt\": \"Explic\u0103 pe scurt ce este un certificat SSL\",\r\n  \"stream\": false\r\n}'<\/code><\/pre>\n<h2>Chat cu istoric (\/api\/chat)<\/h2>\n<pre><code>curl http:\/\/127.0.0.1:11434\/api\/chat -d '{\r\n  \"model\": \"llama3.1\",\r\n  \"messages\": [\r\n    {\"role\":\"system\",\"content\":\"E\u0219ti un asistent util.\"},\r\n    {\"role\":\"user\",\"content\":\"Salut!\"}\r\n  ],\r\n  \"stream\": false\r\n}'<\/code><\/pre>\n<h2>Embeddings (\/api\/embeddings)<\/h2>\n<p>Pentru c\u0103utare semantic\u0103 \/ RAG:<\/p>\n<pre><code>curl http:\/\/127.0.0.1:11434\/api\/embeddings -d '{\r\n  \"model\": \"nomic-embed-text\",\r\n  \"prompt\": \"text de indexat\"\r\n}'<\/code><\/pre>\n<h2>Endpoint compatibil OpenAI<\/h2>\n<p>Ollama ofer\u0103 \u0219i un endpoint compatibil OpenAI la <code>\/v1<\/code>, astfel \u00eenc\u00e2t multe aplica\u021bii care \u201evorbesc&#8221; protocolul OpenAI \u00eel pot folosi direct:<\/p>\n<pre><code>curl http:\/\/127.0.0.1:11434\/v1\/chat\/completions -d '{\r\n  \"model\": \"llama3.1\",\r\n  \"messages\": [{\"role\":\"user\",\"content\":\"Salut!\"}]\r\n}'<\/code><\/pre>\n<h2>Streaming<\/h2>\n<p>Implicit, API-ul \u201etransmite&#8221; r\u0103spunsul token cu token (streaming). Seteaz\u0103 <code>\"stream\": false<\/code> dac\u0103 vrei r\u0103spunsul complet dintr-o dat\u0103.<\/p>\n<div class=\"note\">\n<p><strong>Sfat:<\/strong> Endpointul compatibil OpenAI este cel mai simplu mod de a conecta Ollama la aplica\u021bii existente \u2014 de multe ori schimbi doar \u201ebase URL&#8221;-ul c\u0103tre <code>http:\/\/IP:11434\/v1<\/code>.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Pe l\u00e2ng\u0103 linia de comand\u0103, Ollama expune un API local pe portul 11434, cu care alte aplica\u021bii pot folosi modelele. Are at\u00e2t un API propriu, c\u00e2t \u0219i un endpoint compatibil OpenAI. Generarea de text (\/api\/generate) curl http:\/\/127.0.0.1:11434\/api\/generate -d &#8216;{ &#8222;model&#8221;: &#8222;llama3.1&#8221;, &#8222;prompt&#8221;: &#8222;Explic\u0103 pe scurt ce este un certificat SSL&#8221;, &#8222;stream&#8221;: false }&#8217; Chat cu &#8230; <a title=\"Cum folosesc API-ul Ollama (REST \u0219i endpoint compatibil OpenAI)?\" class=\"read-more\" href=\"https:\/\/www.hostx.ro\/kb\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\/\" aria-label=\"Cite\u0219te mai multe despre Cum folosesc API-ul Ollama (REST \u0219i endpoint compatibil OpenAI)?\">Cite\u0219te mai mult<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"whmcs_kb_id":0,"footnotes":""},"doc_category":[512],"doc_tag":[262,363,452,243,421,527],"class_list":["post-6675","docs","type-docs","status-publish","hentry","doc_category-ollama","doc_tag-api","doc_tag-debugging","doc_tag-integrare","doc_tag-linia-de-comanda","doc_tag-node-js","doc_tag-ollama"],"year_month":"2026-11","word_count":200,"total_views":"7","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"benyhill","author_nicename":"benyhill","author_url":"https:\/\/www.hostx.ro\/kb\/author\/benyhill\/"},"doc_category_info":[{"term_name":"Ollama","term_url":"https:\/\/www.hostx.ro\/kb\/docs-category\/ollama\/"}],"doc_tag_info":[{"term_name":"API","term_url":"https:\/\/www.hostx.ro\/kb\/docs-tag\/api\/"},{"term_name":"debugging","term_url":"https:\/\/www.hostx.ro\/kb\/docs-tag\/debugging\/"},{"term_name":"integrare","term_url":"https:\/\/www.hostx.ro\/kb\/docs-tag\/integrare\/"},{"term_name":"linia de comand\u0103","term_url":"https:\/\/www.hostx.ro\/kb\/docs-tag\/linia-de-comanda\/"},{"term_name":"Node.js","term_url":"https:\/\/www.hostx.ro\/kb\/docs-tag\/node-js\/"},{"term_name":"Ollama","term_url":"https:\/\/www.hostx.ro\/kb\/docs-tag\/ollama\/"}],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>API Ollama: REST \u0219i endpoint OpenAI compatibil - Centrul de suport HostX<\/title>\n<meta name=\"description\" content=\"Ghid complet pentru utilizarea API-ului Ollama local pe portul 11434. Exploreaz\u0103 endpoint-urile REST proprii \u0219i compatibilul OpenAI pentru generare text, chat \u0219i embeddings.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.hostx.ro\/kb\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\/\" \/>\n<meta property=\"og:locale\" content=\"ro_RO\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"API Ollama: REST \u0219i endpoint OpenAI compatibil - Centrul de suport HostX\" \/>\n<meta property=\"og:description\" content=\"Ghid complet pentru utilizarea API-ului Ollama local pe portul 11434. Exploreaz\u0103 endpoint-urile REST proprii \u0219i compatibilul OpenAI pentru generare text, chat \u0219i embeddings.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.hostx.ro\/kb\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\/\" \/>\n<meta property=\"og:site_name\" content=\"Centrul de suport HostX\" \/>\n<meta property=\"article:modified_time\" content=\"2026-08-21T08:12:26+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Timp estimat pentru citire\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minut\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.hostx.ro\\\/kb\\\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\\\/\",\"url\":\"https:\\\/\\\/www.hostx.ro\\\/kb\\\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\\\/\",\"name\":\"API Ollama: REST \u0219i endpoint OpenAI compatibil - Centrul de suport HostX\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.hostx.ro\\\/kb\\\/#website\"},\"datePublished\":\"2026-08-21T08:12:09+00:00\",\"dateModified\":\"2026-08-21T08:12:26+00:00\",\"description\":\"Ghid complet pentru utilizarea API-ului Ollama local pe portul 11434. Exploreaz\u0103 endpoint-urile REST proprii \u0219i compatibilul OpenAI pentru generare text, chat \u0219i embeddings.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.hostx.ro\\\/kb\\\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\\\/#breadcrumb\"},\"inLanguage\":\"ro-RO\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.hostx.ro\\\/kb\\\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.hostx.ro\\\/kb\\\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Prima pagin\u0103\",\"item\":\"https:\\\/\\\/www.hostx.ro\\\/kb\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"InfoCentru\",\"item\":\"https:\\\/\\\/www.hostx.ro\\\/kb\\\/docs\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Cum folosesc API-ul Ollama (REST \u0219i endpoint compatibil OpenAI)?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.hostx.ro\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.hostx.ro\\\/kb\\\/\",\"name\":\"Centrul de suport HostX\",\"description\":\"tutoriale gazduire web, domenii web \u0219i servere\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.hostx.ro\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ro-RO\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"API Ollama: REST \u0219i endpoint OpenAI compatibil - Centrul de suport HostX","description":"Ghid complet pentru utilizarea API-ului Ollama local pe portul 11434. Exploreaz\u0103 endpoint-urile REST proprii \u0219i compatibilul OpenAI pentru generare text, chat \u0219i embeddings.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.hostx.ro\/kb\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\/","og_locale":"ro_RO","og_type":"article","og_title":"API Ollama: REST \u0219i endpoint OpenAI compatibil - Centrul de suport HostX","og_description":"Ghid complet pentru utilizarea API-ului Ollama local pe portul 11434. Exploreaz\u0103 endpoint-urile REST proprii \u0219i compatibilul OpenAI pentru generare text, chat \u0219i embeddings.","og_url":"https:\/\/www.hostx.ro\/kb\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\/","og_site_name":"Centrul de suport HostX","article_modified_time":"2026-08-21T08:12:26+00:00","twitter_card":"summary_large_image","twitter_misc":{"Timp estimat pentru citire":"1 minut"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.hostx.ro\/kb\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\/","url":"https:\/\/www.hostx.ro\/kb\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\/","name":"API Ollama: REST \u0219i endpoint OpenAI compatibil - Centrul de suport HostX","isPartOf":{"@id":"https:\/\/www.hostx.ro\/kb\/#website"},"datePublished":"2026-08-21T08:12:09+00:00","dateModified":"2026-08-21T08:12:26+00:00","description":"Ghid complet pentru utilizarea API-ului Ollama local pe portul 11434. Exploreaz\u0103 endpoint-urile REST proprii \u0219i compatibilul OpenAI pentru generare text, chat \u0219i embeddings.","breadcrumb":{"@id":"https:\/\/www.hostx.ro\/kb\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\/#breadcrumb"},"inLanguage":"ro-RO","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.hostx.ro\/kb\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.hostx.ro\/kb\/cum-folosesc-api-ul-ollama-rest-si-endpoint-compatibil-openai\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Prima pagin\u0103","item":"https:\/\/www.hostx.ro\/kb\/"},{"@type":"ListItem","position":2,"name":"InfoCentru","item":"https:\/\/www.hostx.ro\/kb\/docs\/"},{"@type":"ListItem","position":3,"name":"Cum folosesc API-ul Ollama (REST \u0219i endpoint compatibil OpenAI)?"}]},{"@type":"WebSite","@id":"https:\/\/www.hostx.ro\/kb\/#website","url":"https:\/\/www.hostx.ro\/kb\/","name":"Centrul de suport HostX","description":"tutoriale gazduire web, domenii web \u0219i servere","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.hostx.ro\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ro-RO"}]}},"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/www.hostx.ro\/kb\/wp-json\/wp\/v2\/docs\/6675","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostx.ro\/kb\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.hostx.ro\/kb\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostx.ro\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostx.ro\/kb\/wp-json\/wp\/v2\/comments?post=6675"}],"version-history":[{"count":1,"href":"https:\/\/www.hostx.ro\/kb\/wp-json\/wp\/v2\/docs\/6675\/revisions"}],"predecessor-version":[{"id":7242,"href":"https:\/\/www.hostx.ro\/kb\/wp-json\/wp\/v2\/docs\/6675\/revisions\/7242"}],"wp:attachment":[{"href":"https:\/\/www.hostx.ro\/kb\/wp-json\/wp\/v2\/media?parent=6675"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.hostx.ro\/kb\/wp-json\/wp\/v2\/doc_category?post=6675"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hostx.ro\/kb\/wp-json\/wp\/v2\/doc_tag?post=6675"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}