Releases: dev2k6/x-ai-proxy-server
v1.0.2
Release v1.0.2
Major feature release focused on full AI Agent compatibility.
Highlights
- Complete tool calling support (round-trip)
- Vision / image input support
response_formatforwarding (JSON mode & structured outputs)- All binaries rebuilt with latest features
New Features
Full Tool Calling Support
The proxy now fully supports OpenAI-style tool calling:
Assistant messages with tool calls:
{
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_xxx",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"location\":\"Hanoi\"}"
}
}
]
}Tool result messages:
{
"role": "tool",
"tool_call_id": "call_xxx",
"content": "Sunny, 32°C"
}This enables complete agent tool-calling loops.
Vision / Image Support
ContentPart now accepts image inputs:
{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{"type": "image_url", "image_url": {"url": "https://...", "detail": "high"}}
]
}Images are converted to text representation [image: url] when sent to the xAI backend.
Response Format
response_format is now forwarded:
{
"response_format": {"type": "json_object"}
}Supports both simple JSON mode and structured outputs with JSON schema.
Binaries
All platform binaries have been rebuilt:
| File | Platform | Size |
|---|---|---|
proxy-windows-amd64.exe |
Windows x64 | 9.2M |
proxy-linux-amd64 |
Linux x64 | 9.2M |
proxy-darwin-amd64 |
macOS Intel | 9.3M |
proxy-darwin-arm64 |
macOS Apple Silicon | 8.7M |
Upgrade Notes
- Drop-in replacement — no config changes required
- Existing
config.jsonremains compatible - Agents using tool calling or vision will now work without JSON errors
Testing
Verified flows:
- Tool calling round-trip (assistant → tool → assistant)
- Messages containing images
response_formatpassthrough- All previous features remain functional
Full Changelog
See commit a237bb3.
Previous release: v1.0.1 (f44d777)
v1.0.1
Release v1.0.1
Minor release with improved AI Agent compatibility and cross-platform distribution.
Highlights
message.contentnow accepts both string and array of content parts (fixes vision/tool-calling agents)- Pre-built binaries for all major platforms available in
bin/ - README cleaned up and updated for current usage
New Features
Flexible Message Content
OpenAIMessage.Content now supports the full OpenAI format:
// Simple string (still works)
{"role": "user", "content": "Hello"}
// Array of content parts (new - required by many AI Agents)
{"role": "user", "content": [{"type": "text", "text": "Hello"}]}This fixes the error:
json: cannot unmarshal array into Go struct field OpenAIMessage.messages
when connecting AI Agents that use vision or tool-calling formats.
Cross-Platform Binaries
All binaries are now located in bin/:
| File | Platform |
|---|---|
proxy-windows-amd64.exe |
Windows (x64) |
proxy-linux-amd64 |
Linux (x64) |
proxy-darwin-amd64 |
macOS Intel |
proxy-darwin-arm64 |
macOS Apple Silicon |
No external dependencies required. ~9MB each.
Changes
- Moved from root-level single binary to organized
bin/folder - Removed outdated "Environment Variables" section from README (config is now fully
config.jsondriven) - Updated project structure documentation
- Internal refactor: introduced
MessageContenttype with custom JSON unmarshaling
Upgrade Notes
- Existing
config.jsonremains fully compatible - No breaking changes to API or configuration
- Replace old
proxy.exewith the appropriate binary frombin/
Testing
All previous flows continue to pass. Additional verification:
- AI Agent sending array content → now succeeds
- All 4 platform binaries execute correctly on target OS
Checksums (example)
Run after download:
sha256sum bin/*Full Changelog
See commit f44d777 for detailed changes.
Previous release: v1.0.0 (cdc9f1e)
v1.0.0
Release v1.0.0
First stable release of xAI OpenAI-Compatible Proxy.
Highlights
- Drop-in replacement for OpenAI chat completions API
- HTTP/2 transport to xAI backend (bypasses Cloudflare 403)
- Streaming and non-streaming responses with proper
finish_reason - Optional API key authentication for multi-user deployments
- Zero-config for single-user (empty
api_key)
Features
API Compatibility
POST /v1/chat/completions— full OpenAI request/response formatGET /v1/models— returns 5 xAI models- Streaming SSE with
finish_reason: "stop"in final chunk - Standardized error envelope:
{"error": {"message", "type", "code"}} - CORS headers enabled for browser-based agents
Configuration
config.jsondriven (host, port, api_key, headers)api_keyoptional — leave empty to disable auth- When set, clients must send
Authorization: Bearer <key> - 401 returned for missing or invalid key
Transport
- Go
http.Transport{ForceAttemptHTTP2: true}— matches Postman behavior - 120s timeout, connection pooling
- SSE parser with 1MB buffer for long responses
Usage
# 1. Copy template
cp config.json.example config.json
# 2. Edit config.json
# - Paste Cookie header from console.x.ai (Network tab)
# - Set api_key (optional, empty = no auth)
# - Adjust host/port if needed
# 3. Run
./proxy.exe
# 4. Call with OpenAI SDK
from openai import OpenAI
client = OpenAI(base_url="http://localhost:60443/v1", api_key="not-needed-or-your-proxy-key")
resp = client.chat.completions.create(model="grok-4.3", messages=[{"role":"user","content":"Hi"}])
print(resp.choices[0].message.content)Authentication
| api_key in config | Client header required | Result |
|---|---|---|
"" (empty) |
None | 200 |
"sk-xxx" |
Authorization: Bearer sk-xxx |
200 |
"sk-xxx" |
Missing / wrong key | 401 |
Tested Flows
- Non-stream completion
- Stream with
finish_reason - Multi-turn conversation
- Concurrent requests (3+)
- Long messages (5K+ chars)
- System messages
- All OpenAI optional params passthrough
- CORS preflight
- Method not allowed (405)
- Invalid JSON (400)
- Upstream error wrapping (502)
- Missing/invalid config.json at startup
All 13 scenarios pass.
Limitations
- Token usage always returns
0(xAI SSE does not emit token counts) - Some OpenAI params (
n>1, certain stop behaviors) may be ignored by backend - Cookie refresh required when Cloudflare tokens (
cf_clearance,__cf_bm) expire (IP-bound)
Files
proxy.exe— Windows amd64 binary (Go 1.24)config.json.example— template with placeholders- Source included for custom builds
Upgrade Notes
First release — no upgrade path. Fresh install only.
Checksum (example)
SHA256(proxy.exe) = <run sha256sum after download>
Support
Open an issue with:
config.json(redact Cookie)- Request/response logs
- Go version and OS
Full commit: cdc9f1e — feat: xAI OpenAI-compatible proxy server