Spaces:
Paused
Paused
File size: 1,726 Bytes
df77864 32c9a94 df77864 32c9a94 df77864 32c9a94 |
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
---
title: Ki2API - Claude Sonnet 4 OpenAI Compatible API
emoji: π€
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
---
# Ki2API - Claude Sonnet 4 OpenAI Compatible API
OpenAI-compatible API for Claude Sonnet 4 via AWS CodeWhisperer. This service provides streaming support, tool calls, and multiple model access through a familiar OpenAI API interface.
## Features
- π **Streaming Support**: Real-time response streaming
- π οΈ **Tool Calls**: Function calling capabilities
- π― **Multiple Models**: Support for Claude Sonnet 4 and Claude 3.5 Haiku
- π§ **XML Tool Parsing**: Advanced tool call parsing
- π **Auto Token Refresh**: Automatic authentication token management
- π‘οΈ **Null Content Handling**: Robust message processing
- π **Tool Call Deduplication**: Prevents duplicate function calls
## API Endpoints
- `GET /v1/models` - List available models
- `POST /v1/chat/completions` - Create chat completions
- `GET /health` - Health check
- `GET /` - Service information
## Environment Variables
Required environment variables:
- `API_KEY` - Bearer token for API authentication (default: ki2api-key-2024)
- `KIRO_ACCESS_TOKEN` - Kiro access token
- `KIRO_REFRESH_TOKEN` - Kiro refresh token
## Usage
```bash
curl -X POST https://your-space-url/v1/chat/completions \n -H "Authorization: Bearer ki2api-key-2024" \n -H "Content-Type: application/json" \n -d '{
"model": "claude-sonnet-4-20250514",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
```
## Supported Models
- `claude-sonnet-4-20250514` - Claude Sonnet 4 (Latest)
- `claude-3-5-haiku-20241022` - Claude 3.5 Haiku
Built with FastAPI and optimized for Hugging Face Spaces deployment. |