CLF AI Gateway
CLF AI Gateway
CLF AI Gateway는 오픈웨이트 모델을 서빙하는 OpenAI 호환 게이트웨이예요. 독립된 서비스로 Cloudflare와 제휴하지 않으며, Cloudflare 자체 추론 제품은 Cloudflare Workers AI를 참고하세요.
model=clf_ai_gateway/<model>로 설정하면 요청을 CLF AI Gateway를 통해 라우팅해요. 현재 모델 목록은 https://clfaigateway.dev/models 와GET /v1/models에 있어요.
출처: 문서
본문
API 키
import os
os.environ["CLF_AI_GATEWAY_API_KEY"] = "sk-gw-..."
os.environ["CLF_AI_GATEWAY_API_BASE"] = "https://api.clfaigateway.dev/v1" # optional, this is the default
CLF_AI_GATEWAY_API_BASE는 LiteLLM을 다른 엔드포인트로 가리킬 때만 설정하면 돼요. 설정하지 않으면 https://api.clfaigateway.dev/v1을 사용해요.
샘플 사용법 (Sample Usage)
from litellm import completion
import os
os.environ["CLF_AI_GATEWAY_API_KEY"] = "sk-gw-..."
response = completion(
model="clf_ai_gateway/glm-5.3",
messages=[{"role": "user", "content": "What character was Wall-e in love with?"}],
)
print(response)
샘플 사용법 - 스트리밍
from litellm import completion
import os
os.environ["CLF_AI_GATEWAY_API_KEY"] = "sk-gw-..."
response = completion(
model="clf_ai_gateway/glm-5.3",
messages=[{"role": "user", "content": "What character was Wall-e in love with?"}],
stream=True,
)
for chunk in response:
print(chunk)
Reasoning
from litellm import completion
import os
os.environ["CLF_AI_GATEWAY_API_KEY"] = "sk-gw-..."
response = completion(
model="clf_ai_gateway/glm-5.3",
messages=[{"role": "user", "content": "How many r's are in strawberry?"}],
reasoning_effort="high",
)
print(response)
게이트웨이의 모든 모델은 reasoning 모델이므로 모든 모델에서 reasoning_effort를 받아요. 각 모델이 받는 레벨은 다르며, LiteLLM은 단일 세트를 가정하지 않고 모델 맵에서 읽어요.
Reasoning 토큰은 completion_tokens 안에 계산되므로 출력 가격으로 별도로 부과되지 않고 청구돼요.
LiteLLM Proxy Server 사용법
config.yaml에 모델 추가:
model_list:
- model_name: my-model
litellm_params:
model: clf_ai_gateway/glm-5.3
api_key: os.environ/CLF_AI_GATEWAY_API_KEY
Proxy 시작:
$ litellm --config /path/to/config.yaml
요청 보내기:
OpenAI Python v1.0.0+:
import openai
client = openai.OpenAI(
api_key="litellm-proxy-key",
base_url="http://0.0.0.0:4000",
)
response = client.chat.completions.create(
model="my-model",
messages=[{"role": "user", "content": "What character was Wall-e in love with?"}],
)
print(response)
curl:
curl --location 'http://0.0.0.0:4000/chat/completions' \
--header 'Authorization: Bearer ***' \
--header 'Content-Type: application/json' \
--data '{
"model": "my-model",
"messages": [
{
"role": "user",
"content": "What character was Wall-e in love with?"
}
]
}'
지원 모델 (Supported Models)
이 모든 모델이 tool calling, JSON mode, reasoning을 지원해요.
| 모델 | 컨텍스트 창 | 비전 |
|---|---|---|
| clf_ai_gateway/glm-5.3 | 1,048,576 | no |
| clf_ai_gateway/glm-5.3-flash | 1,048,576 | yes |
| clf_ai_gateway/glm-5.2 | 262,144 | no |
| clf_ai_gateway/glm-4.7-flash | 131,072 | no |
| clf_ai_gateway/kimi-k2.7-code | 262,144 | yes |
| clf_ai_gateway/kimi-k2.6 | 262,144 | yes |
| clf_ai_gateway/deepseek-v4-pro | 1,048,576 | no |
| clf_ai_gateway/deepseek-v4-flash | 1,048,576 | no |
| clf_ai_gateway/qwen3.8-27b | 262,144 | yes |
지원 파라미터 (Supported Parameters)
| 파라미터 | 타입 | 설명 |
|---|---|---|
| frequency_penalty | number | 텍스트에서 빈도에 따라 새 토큰에 패널티 |
| max_completion_tokens | integer | 생성할 최대 토큰 수 |
| max_tokens | integer | 생성할 최대 토큰 수 |
| n | integer | 생성할 완성 수 |
| parallel_tool_calls | boolean | 모델이 한 번에 여러 도구를 호출할 수 있는지 여부 |
| presence_penalty | number | 지금까지 텍스트에 등장했는지에 따라 토큰에 패널티 |
| reasoning_effort | string | 모델이 답변 전 얼마나 추론하는지 |
| response_format | object | 응답 형식, 예: {"type": "json_object"} |
| seed | integer | 결정적 결과용 샘플링 시드 |
| stop | string/array | API가 토큰 생성을 멈추는 시퀀스 |
| stream | boolean | 응답을 스트리밍할지 여부 |
| stream_options | object | 스트리밍 옵션, 예: {"include_usage": true} |
| temperature | number | 무작위성 제어 |
| tool_choice | string/object | 모델이 호출할 도구, 있으면 제어 |
| tools | array | 모델이 사용할 수 있는 도구 목록 |
| top_p | number | Nucleus sampling 제어 |
| user | string | 사용자 식별자 |