[PR #2506] [CLOSED] Added support for OpenAI's Multimodal messages format, Enabled CORS headers #57612

Closed
opened 2026-04-29 12:17:29 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/2506
Author: @matbeedotcom
Created: 2/15/2024
Status: Closed

Base: mainHead: main


📝 Commits (3)

  • 7b4a747 CORS Headers wildcarded. OpenAI Endpoint supporting image_url/text specification.
  • a80d6f0 CORS Headers wildcarded. OpenAI Endpoint supporting image_url/text specification.
  • 41f51b4 CORS Headers wildcarded. OpenAI Endpoint supporting image_url/text specification.

📊 Changes

2 files changed (+44 additions, -3 deletions)

View changed files

📝 openai/openai.go (+43 -3)
📝 server/routes.go (+1 -0)

📄 Description

Allows for inference via openai's api sdk.

    const response = await openai.chat.completions.create({
      model: MultiModalLanguage.model,
      messages: [
        { role: 'system', content: MultiModalLanguage.system },
        {
          role: 'user',
          content: [
            { type: 'image_url', image_url: { url: encodedString } },
          ],
        },
      ],
      max_tokens: 500,
    }, {
        headers: {}
    });

CORS headers were blocked from the OpenAI SDK when executed in the browser context.

Access to fetch at 'http://localhost:11434/v1/chat/completions' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field x-stainless-os is not allowed by Access-Control-Allow-Headers in preflight response.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/2506 **Author:** [@matbeedotcom](https://github.com/matbeedotcom) **Created:** 2/15/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (3) - [`7b4a747`](https://github.com/ollama/ollama/commit/7b4a747414eab8c5b69e0991f87b57bd47d87f79) CORS Headers wildcarded. OpenAI Endpoint supporting image_url/text specification. - [`a80d6f0`](https://github.com/ollama/ollama/commit/a80d6f0a7392cd72335340bad13209b6ddbc3ec6) CORS Headers wildcarded. OpenAI Endpoint supporting image_url/text specification. - [`41f51b4`](https://github.com/ollama/ollama/commit/41f51b447f779ba1ed313015c09eb47105b0e780) CORS Headers wildcarded. OpenAI Endpoint supporting image_url/text specification. ### 📊 Changes **2 files changed** (+44 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `openai/openai.go` (+43 -3) 📝 `server/routes.go` (+1 -0) </details> ### 📄 Description Allows for inference via openai's api sdk. ``` const response = await openai.chat.completions.create({ model: MultiModalLanguage.model, messages: [ { role: 'system', content: MultiModalLanguage.system }, { role: 'user', content: [ { type: 'image_url', image_url: { url: encodedString } }, ], }, ], max_tokens: 500, }, { headers: {} }); ``` CORS headers were blocked from the OpenAI SDK when executed in the browser context. ``` Access to fetch at 'http://localhost:11434/v1/chat/completions' from origin 'http://localhost:3000' has been blocked by CORS policy: Request header field x-stainless-os is not allowed by Access-Control-Allow-Headers in preflight response. ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-29 12:17:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#57612