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

What is the variable G4F_API_KEY in the Dockerfile of Hugging Face? #2502

Open
hhhaiai opened this issue Dec 20, 2024 · 2 comments
Open

What is the variable G4F_API_KEY in the Dockerfile of Hugging Face? #2502

hhhaiai opened this issue Dec 20, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@hhhaiai
Copy link

hhhaiai commented Dec 20, 2024

What is the variable G4F_API_KEY in the Dockerfile of Hugging Face?
Is it used to set the account password for access? Hugging Face G4F_API_KEY

FROM python:3.9

ARG G4F_API_KEY
ARG G4F_IGNORED_PROVIDERS

RUN useradd -m -u 1000 user
WORKDIR /app

COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

COPY --chown=user . /app

USER user

ENV HOME=/home/user \
	PATH=/home/user/.local/bin:$PATH

ENV G4F_API_KEY $G4F_API_KEY
ENV G4F_IGNORED_PROVIDERS $G4F_IGNORED_PROVIDERS

CMD python -m g4f --port 7860 --debug --g4f-api-key $G4F_API_KEY --ignored-providers $G4F_IGNORED_PROVIDERS

@hhhaiai hhhaiai added the bug Something isn't working label Dec 20, 2024
@hhhaiai
Copy link
Author

hhhaiai commented Dec 20, 2024

Access Information
To access the space, please use the following login credentials:

Username: any
Password: gpt4free

如何设置?

@hhhaiai
Copy link
Author

hhhaiai commented Dec 20, 2024

To modify the API endpoint from "http://localhost:5002/v1/chat/completions" to "http://localhost:5002/api/v1/chat/completions", simply replace the original URL with the new one in the cURL command, as shown below:

curl http://localhost:5002/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {"role": "user", "content": "Hello, how are you?"}
    ],
    "max_tokens": 100
  }'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants