Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OpenAI-like service #592

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

denisshepelin
Copy link

Following the Gemini and Claude service I propose the simple interface to OpenAI-compatible endpoints.

I've checked it with Openrouter and gpt-4o-mini, seems to work fine.

It has tracking of tokens and API call counts.

Copy link
Contributor

github-actions bot commented Mar 3, 2025

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@denisshepelin
Copy link
Author

I have read the CLA document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Mar 3, 2025
@VikParuchuri
Copy link
Owner

Thanks for the contribution! This looks great, but I will need to find some time to test it before merging

@scottydelta
Copy link

@denisshepelin I tried this PR, getting this error:

Error code: 401 - {'error': {'message': 'No auth credentials found', 'code': 401}}
Error code: 401 - {'error': {'message': 'No auth credentials found', 'code': 401}}
Error code: 401 - {'error': {'message': 'No auth credentials found', 'code': 401}}
Error code: 401 - {'error': {'message': 'No auth credentials found', 'code': 401}}
Error code: 401 - {'error': {'message': 'No auth credentials found', 'code': 401}}

Here is the config:

config = {
        "output_format": "markdown",
        "output_dir": folder_path,
        "use_llm": True,
        "llm_service": "marker.services.openai.OpenAIService",
        "openai_key": "KEY_HERE",
    }

code used to install this branch:

pip install git+https://github.com/denisshepelin/marker@openai_like_service

@denisshepelin
Copy link
Author

@scottydelta you will also need to provide a openai_base_url="https://api.openai.com/v1" if it's openai model and openai_model="gpt-4o-mini" .

My idea was to create a OpenAI-compatible interface where people can use any model that supports pythons openai module (like Grok or Gemini with experimental OpenAI support)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants