| --- |
| title: Oh My API |
| emoji: ๐พ |
| colorFrom: pink |
| colorTo: purple |
| sdk: docker |
| pinned: true |
| license: mit |
| --- |
| |
| <div align="center"> |
|
|
| <br/> |
|
|
| ``` |
| โโโโโโโ โโโ โโโ โโโโ โโโโโโโ โโโ โโโโโโ โโโโโโโ โโโ |
| โโโโโโโโโโโโ โโโ โโโโโ โโโโโโโโโ โโโโ โโโโโโโโโโโโโโโโโโโ |
| โโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโ โโโโโโโโโโโโโโโโโโโ |
| โโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโ โโโโโโโโโโโโโโโ โโโ |
| โโโโโโโโโโโโ โโโ โโโ โโโ โโโ โโโ โโโ โโโโโโ โโโ |
| โโโโโโโ โโโ โโโ โโโ โโโ โโโ โโโ โโโโโโ โโโ |
| ``` |
|
|
| **็ปไธ AI API ไปฃ็็ฝๅ
ณ** |
|
|
| [](.) |
| [](.) |
| [](.) |
| [](.) |
|
|
| <br/> |
|
|
| > ไธไธช่ฟ่กๅจ HuggingFace Space ไธ็้ซๆง่ฝ AI API ไปฃ็๏ผ<br/> |
| > ็ปไธๆฅๅ
ฅ Claude ยท Gemini ยท OpenAI ยท Codex ยท Vertex AI |
|
|
| <br/> |
|
|
| </div> |
|
|
| --- |
|
|
| ## โก ๆฏๆ็ๆจกๅ |
|
|
| | ๆไพๅ | ๆฏๆๆจกๅ | ๆฅๅ
ฅๆนๅผ | |
| |--------|----------|----------| |
| | ๐ฃ **Anthropic Claude** | Claude 4.5 / 4.6 ๅ
จ็ณปๅ | API Key | |
| | ๐ต **Google Gemini** | Gemini 3.1 Pro / Flash | API Key | |
| | ๐ข **OpenAI** | GPT-5.1 / GPT-5.2 | API Key | |
| | ๐ก **Vertex AI** | Gemini on Vertex | ๆๅก่ดฆๅท | |
| | โช **OpenAI-compat** | ไปปๆๅ
ผๅฎน OpenAI ๆ ผๅผ็ๆๅก | API Key | |
|
|
| --- |
|
|
| ## ๐ ๅฟซ้ๆฅๅ
ฅ |
|
|
| ๅฐไฝ ็ API Base URL ๆฟๆขไธบๆฌ Space ๅฐๅๅณๅฏ๏ผ |
|
|
| ```bash |
| # ๅๅง่ฏทๆฑ |
| curl https://api.anthropic.com/v1/messages ... |
| |
| # ๆฟๆขไธบๆฌไปฃ็ |
| curl https://ohmyapi-2api.hf.space/v1/messages \ |
| -H "x-api-key: ไฝ ็่ฎฟ้ฎๅฏ้ฅ" \ |
| -H "Content-Type: application/json" \ |
| -d '{"model": "claude-4-6-sonnet", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello"}]}' |
| ``` |
|
|
| ### Python ็คบไพ |
|
|
| ```python |
| import anthropic |
| |
| client = anthropic.Anthropic( |
| api_key="ไฝ ็่ฎฟ้ฎๅฏ้ฅ", |
| base_url="https://ohmyapi-2api.hf.space", |
| ) |
| |
| message = client.messages.create( |
| model="claude-4-6-sonnet", |
| max_tokens=1024, |
| messages=[{"role": "user", "content": "ไฝ ๅฅฝ๏ผ"}] |
| ) |
| print(message.content) |
| ``` |
|
|
| ### OpenAI SDK ๅ
ผๅฎน |
|
|
| ```python |
| from openai import OpenAI |
| |
| client = OpenAI( |
| api_key="ไฝ ็่ฎฟ้ฎๅฏ้ฅ", |
| base_url="https://ohmyapi-2api.hf.space/openai", |
| ) |
| |
| response = client.chat.completions.create( |
| model="gpt-5.1", |
| messages=[{"role": "user", "content": "ไฝ ๅฅฝ๏ผ"}] |
| ) |
| ``` |
|
|
| --- |
|
|
| ## ๐๏ธ ๆๆฏๆถๆ |
|
|
| ``` |
| โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ |
| โ HuggingFace Space โ |
| โ โ |
| โ Client Request โ |
| โ โ โ |
| โ โผ โ |
| โ โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โ โ โ Supabase PostgreSQL โ โ |
| โ โ CLIProxyAPI โโโโโโโโโบโ Token Store โ โ |
| โ โ :7860 โ โ Config Store โ โ |
| โ โ โ โโโโโโโโโโโโโโโโโโโโโโโโ โ |
| โ โโโโโโโโฌโโโโโโโ โ |
| โ โ โ |
| โโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ |
| โ |
| โโโโโโโโดโโโโโโโโ |
| โ โ |
| โผ โผ |
| Anthropic Google |
| Claude API Gemini API |
| ``` |
|
|
| --- |
|
|
| ## โ๏ธ ้จ็ฝฒ้
็ฝฎ |
|
|
| ### ๅฟ
้็ฏๅขๅ้ |
|
|
| ๅจ HuggingFace Space **Settings โ Secrets** ไธญ้
็ฝฎ๏ผ |
|
|
| | ๅ้ๅ | ่ฏดๆ | ็คบไพ | |
| |--------|------|------| |
| | `PGSTORE_DSN` | PostgreSQL ่ฟๆฅๅญ็ฌฆไธฒ | `postgresql://user:pass@host:6543/postgres?default_query_exec_mode=simple_protocol` | |
| | `MANAGEMENT_PASSWORD` | ็ฎก็ๅๅฐๅฏ็ | `your-secure-password` | |
|
|
| ## ๐ ๆทปๅ API Key |
|
|
| ๆๅกๅฏๅจๅ๏ผ้่ฟ็ฎก็ๆฅๅฃๆทปๅ ไฝ ็ API Key๏ผ |
|
|
| ```bash |
| # ๆทปๅ Claude Key |
| curl -X POST https://ohmyapi-2api.hf.space/management/clients \ |
| -H "Authorization: Bearer $MANAGEMENT_PASSWORD" \ |
| -H "Content-Type: application/json" \ |
| -d '{ |
| "name": "my-client", |
| "claude-keys": ["sk-ant-api03-xxxxx"] |
| }' |
| |
| # ๆทปๅ Gemini Key |
| curl -X POST https://ohmyapi-2api.hf.space/management/clients \ |
| -H "Authorization: Bearer $MANAGEMENT_PASSWORD" \ |
| -H "Content-Type: application/json" \ |
| -d '{ |
| "name": "my-client", |
| "gemini-keys": ["AIzaSy-xxxxx"] |
| }' |
| ``` |
|
|
| --- |
|
|
| <div align="center"> |
|
|
| <br/> |
|
|
| Built with โค๏ธ ยท Powered by [CLIProxyAPI](https://github.com/eceasy/cli-proxy-api) ยท Hosted on [HuggingFace](https://huggingface.co) |
|
|
| <br/> |
|
|
| </div> |