gemma-api / README.md
cloudunity's picture
Upload README.md with huggingface_hub
54a3c09 verified
|
Raw
History Blame Contribute Delete
860 Bytes
---
title: Gemma API
emoji: ๐Ÿš€
colorFrom: blue
colorTo: red
sdk: docker
app_port: 7860
---
# Gemma 4 E4B OpenAI-Compatible API
This Space runs `google_gemma-4-E4B-it` (Q4_K_M GGUF) via `llama-cpp-python[server]`, providing an OpenAI-compatible API endpoint.
## Endpoint
You can use this just like the OpenAI API by pointing your base URL to the Space URL + `/v1`.
```python
from openai import OpenAI
client = OpenAI(
base_url="https://cloudunity-gemma-api.hf.space/v1",
api_key="your_huggingface_token" # Usually ignored by llama.cpp but required by client
)
response = client.chat.completions.create(
model="gemma-4-E4B-it-Q4_K_M", # Model name is ignored if there's only one, but good practice
messages=[
{"role": "user", "content": "Write a short poem about coding."}
]
)
print(response.choices[0].message.content)
```