> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tinypixel.web.id/llms.txt
> Use this file to discover all available pages before exploring further.

# Example Requests

> Code snippets for calling the Gemini API in various languages.

# Example Requests

Once you have your endpoint URL (whether local, hosted test, or your own deployment), you can call the API using these examples.

Replace `https://your-endpoint.com/v1` with your actual base URL.

## cURL (bash/macOS/Linux)

```bash theme={null}
curl https://your-endpoint.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer now-and-then" \
  -d '{
    "model":"gemini-3.5-flash",
    "messages":[{"role":"user","content":"Hello!"}]
  }'
```

## PowerShell (Windows)

```powershell theme={null}
curl.exe --% https://your-endpoint.com/v1/chat/completions `
  -H "Content-Type: application/json" `
  -H "Authorization: Bearer now-and-then" `
  -d "{\"model\":\"gemini-3.5-flash\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello!\"}]}"
```

## Python (OpenAI SDK)

```python theme={null}
from openai import OpenAI
client = OpenAI(
    base_url="https://your-endpoint.com/v1",
    api_key="now-and-then"
)
resp = client.chat.completions.create(
    model="gemini-3.5-flash-thinking",
    messages=[{"role": "user", "content": "Explain quantum computing"}]
)
print(resp.choices[0].message.content)
```

## Using the Hosted Test Endpoints

You can try the API immediately with the hosted test instances (note: these are on free tiers and may have rate limits):

```bash theme={null}
# Cloudflare Workers test endpoint
curl https://free-gem-1.tinypixel.my.id/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer now-and-then" \
  -d '{
    "model":"gemini-3.5-flash",
    "messages":[{"role":"user","content":"Hello!"}]
  }'
```

Replace `free-gem-1` with `free-gem-2` (Netlify), `free-gem-3` (Vercel), or use the Deno endpoint `https://free-gemini.tinypixel.deno.net/v1`.
