Spaces:
Paused
Paused
Commit
Β·
71017fb
1
Parent(s):
0185608
updated readme
Browse files
README.md
CHANGED
|
@@ -20,6 +20,8 @@ A FastAPI-based proxy server that converts the Gemini CLI tool into both OpenAI-
|
|
| 20 |
- **Streaming Support**: Real-time streaming responses for both API formats
|
| 21 |
- **Multimodal Support**: Text and image inputs
|
| 22 |
- **Authentication**: Multiple auth methods (Bearer, Basic, API key)
|
|
|
|
|
|
|
| 23 |
- **Docker Ready**: Containerized for easy deployment
|
| 24 |
- **Hugging Face Spaces**: Ready for deployment on Hugging Face
|
| 25 |
|
|
@@ -127,15 +129,19 @@ client = openai.OpenAI(
|
|
| 127 |
|
| 128 |
# Use like normal OpenAI API
|
| 129 |
response = client.chat.completions.create(
|
| 130 |
-
model="gemini-2.
|
| 131 |
messages=[
|
| 132 |
-
{"role": "user", "content": "
|
| 133 |
],
|
| 134 |
stream=True
|
| 135 |
)
|
| 136 |
|
|
|
|
| 137 |
for chunk in response:
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
| 139 |
```
|
| 140 |
|
| 141 |
## π§ Native Gemini API Example
|
|
@@ -151,14 +157,18 @@ headers = {
|
|
| 151 |
data = {
|
| 152 |
"contents": [
|
| 153 |
{
|
| 154 |
-
"role": "user",
|
| 155 |
-
"parts": [{"text": "
|
| 156 |
}
|
| 157 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
}
|
| 159 |
|
| 160 |
response = requests.post(
|
| 161 |
-
"http://localhost:8888/v1beta/models/gemini-2.
|
| 162 |
headers=headers,
|
| 163 |
json=data
|
| 164 |
)
|
|
@@ -168,12 +178,23 @@ print(response.json())
|
|
| 168 |
|
| 169 |
## π― Supported Models
|
| 170 |
|
| 171 |
-
|
| 172 |
-
- `gemini-
|
| 173 |
-
- `gemini-
|
| 174 |
- `gemini-1.5-pro`
|
|
|
|
| 175 |
- `gemini-1.0-pro`
|
| 176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
## π License
|
| 178 |
|
| 179 |
MIT License - see LICENSE file for details.
|
|
|
|
| 20 |
- **Streaming Support**: Real-time streaming responses for both API formats
|
| 21 |
- **Multimodal Support**: Text and image inputs
|
| 22 |
- **Authentication**: Multiple auth methods (Bearer, Basic, API key)
|
| 23 |
+
- **Google Search Grounding**: Enable Google Search for grounded responses using `-search` models.
|
| 24 |
+
- **Thinking/Reasoning Control**: Control Gemini's thinking process with `-nothinking` and `-maxthinking` models.
|
| 25 |
- **Docker Ready**: Containerized for easy deployment
|
| 26 |
- **Hugging Face Spaces**: Ready for deployment on Hugging Face
|
| 27 |
|
|
|
|
| 129 |
|
| 130 |
# Use like normal OpenAI API
|
| 131 |
response = client.chat.completions.create(
|
| 132 |
+
model="gemini-2.5-pro-maxthinking",
|
| 133 |
messages=[
|
| 134 |
+
{"role": "user", "content": "Explain the theory of relativity in simple terms."}
|
| 135 |
],
|
| 136 |
stream=True
|
| 137 |
)
|
| 138 |
|
| 139 |
+
# Separate reasoning from the final answer
|
| 140 |
for chunk in response:
|
| 141 |
+
if chunk.choices[0].delta.reasoning_content:
|
| 142 |
+
print(f"Thinking: {chunk.choices[0].delta.reasoning_content}")
|
| 143 |
+
if chunk.choices[0].delta.content:
|
| 144 |
+
print(chunk.choices[0].delta.content, end="")
|
| 145 |
```
|
| 146 |
|
| 147 |
## π§ Native Gemini API Example
|
|
|
|
| 157 |
data = {
|
| 158 |
"contents": [
|
| 159 |
{
|
| 160 |
+
"role": "user",
|
| 161 |
+
"parts": [{"text": "Explain the theory of relativity in simple terms."}]
|
| 162 |
}
|
| 163 |
+
],
|
| 164 |
+
"thinkingConfig": {
|
| 165 |
+
"thinkingBudget": 32768,
|
| 166 |
+
"includeThoughts": True
|
| 167 |
+
}
|
| 168 |
}
|
| 169 |
|
| 170 |
response = requests.post(
|
| 171 |
+
"http://localhost:8888/v1beta/models/gemini-2.5-pro:generateContent", # or 7860 for HF
|
| 172 |
headers=headers,
|
| 173 |
json=data
|
| 174 |
)
|
|
|
|
| 178 |
|
| 179 |
## π― Supported Models
|
| 180 |
|
| 181 |
+
### Base Models
|
| 182 |
+
- `gemini-2.5-pro`
|
| 183 |
+
- `gemini-2.5-flash`
|
| 184 |
- `gemini-1.5-pro`
|
| 185 |
+
- `gemini-1.5-flash`
|
| 186 |
- `gemini-1.0-pro`
|
| 187 |
|
| 188 |
+
### Model Variants
|
| 189 |
+
The proxy automatically creates variants for `gemini-2.5-pro` and `gemini-2.5-flash` models:
|
| 190 |
+
|
| 191 |
+
- **`-search`**: Appends `-search` to a model name to enable Google Search grounding.
|
| 192 |
+
- Example: `gemini-2.5-pro-search`
|
| 193 |
+
- **`-nothinking`**: Appends `-nothinking` to minimize reasoning steps.
|
| 194 |
+
- Example: `gemini-2.5-flash-nothinking`
|
| 195 |
+
- **`-maxthinking`**: Appends `-maxthinking` to maximize the reasoning budget.
|
| 196 |
+
- Example: `gemini-2.5-pro-maxthinking`
|
| 197 |
+
|
| 198 |
## π License
|
| 199 |
|
| 200 |
MIT License - see LICENSE file for details.
|