Spaces:
Paused
Paused
File size: 860 Bytes
2375831 f17235b 2375831 f17235b 2375831 54a3c09 f17235b 54a3c09 f17235b 54a3c09 f17235b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | ---
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)
```
|