@homeflare/distilled-litellm 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +77 -0
- package/dist/credentials.d.ts +27 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +67 -0
- package/dist/credentials.js.map +1 -0
- package/dist/errors.d.ts +92 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +72 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/protocol.d.ts +18 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +135 -0
- package/dist/protocol.js.map +1 -0
- package/dist/retry.d.ts +50 -0
- package/dist/retry.d.ts.map +1 -0
- package/dist/retry.js +43 -0
- package/dist/retry.js.map +1 -0
- package/dist/services/a2a.d.ts +70 -0
- package/dist/services/a2a.d.ts.map +1 -0
- package/dist/services/a2a.js +128 -0
- package/dist/services/a2a.js.map +1 -0
- package/dist/services/a2a_registration.d.ts +43 -0
- package/dist/services/a2a_registration.d.ts.map +1 -0
- package/dist/services/a2a_registration.js +40 -0
- package/dist/services/a2a_registration.js.map +1 -0
- package/dist/services/access_groups.d.ts +192 -0
- package/dist/services/access_groups.d.ts.map +1 -0
- package/dist/services/access_groups.js +283 -0
- package/dist/services/access_groups.js.map +1 -0
- package/dist/services/adaptive_router.d.ts +15 -0
- package/dist/services/adaptive_router.d.ts.map +1 -0
- package/dist/services/adaptive_router.js +25 -0
- package/dist/services/adaptive_router.js.map +1 -0
- package/dist/services/agents.d.ts +537 -0
- package/dist/services/agents.d.ts.map +1 -0
- package/dist/services/agents.js +481 -0
- package/dist/services/agents.js.map +1 -0
- package/dist/services/alerting.d.ts +15 -0
- package/dist/services/alerting.d.ts.map +1 -0
- package/dist/services/alerting.js +25 -0
- package/dist/services/alerting.js.map +1 -0
- package/dist/services/anthropic_pass_through.d.ts +70 -0
- package/dist/services/anthropic_pass_through.d.ts.map +1 -0
- package/dist/services/anthropic_pass_through.js +114 -0
- package/dist/services/anthropic_pass_through.js.map +1 -0
- package/dist/services/anthropic_passthrough.d.ts +35 -0
- package/dist/services/anthropic_passthrough.d.ts.map +1 -0
- package/dist/services/anthropic_passthrough.js +59 -0
- package/dist/services/anthropic_passthrough.js.map +1 -0
- package/dist/services/anthropic_skills.d.ts +74 -0
- package/dist/services/anthropic_skills.d.ts.map +1 -0
- package/dist/services/anthropic_skills.js +94 -0
- package/dist/services/anthropic_skills.js.map +1 -0
- package/dist/services/assembly_ai_eu_pass_through.d.ts +70 -0
- package/dist/services/assembly_ai_eu_pass_through.d.ts.map +1 -0
- package/dist/services/assembly_ai_eu_pass_through.js +114 -0
- package/dist/services/assembly_ai_eu_pass_through.js.map +1 -0
- package/dist/services/assembly_ai_pass_through.d.ts +70 -0
- package/dist/services/assembly_ai_pass_through.d.ts.map +1 -0
- package/dist/services/assembly_ai_pass_through.js +114 -0
- package/dist/services/assembly_ai_pass_through.js.map +1 -0
- package/dist/services/assistants.d.ts +185 -0
- package/dist/services/assistants.d.ts.map +1 -0
- package/dist/services/assistants.js +331 -0
- package/dist/services/assistants.js.map +1 -0
- package/dist/services/audio.d.ts +57 -0
- package/dist/services/audio.d.ts.map +1 -0
- package/dist/services/audio.js +96 -0
- package/dist/services/audio.js.map +1 -0
- package/dist/services/audit_logging.d.ts +98 -0
- package/dist/services/audit_logging.d.ts.map +1 -0
- package/dist/services/audit_logging.js +83 -0
- package/dist/services/audit_logging.js.map +1 -0
- package/dist/services/auto_router.d.ts +286 -0
- package/dist/services/auto_router.d.ts.map +1 -0
- package/dist/services/auto_router.js +248 -0
- package/dist/services/auto_router.js.map +1 -0
- package/dist/services/aws_comprehend_medical_pass_through.d.ts +36 -0
- package/dist/services/aws_comprehend_medical_pass_through.d.ts.map +1 -0
- package/dist/services/aws_comprehend_medical_pass_through.js +56 -0
- package/dist/services/aws_comprehend_medical_pass_through.js.map +1 -0
- package/dist/services/azure_ai_pass_through.d.ts +70 -0
- package/dist/services/azure_ai_pass_through.d.ts.map +1 -0
- package/dist/services/azure_ai_pass_through.js +112 -0
- package/dist/services/azure_ai_pass_through.js.map +1 -0
- package/dist/services/azure_pass_through.d.ts +70 -0
- package/dist/services/azure_pass_through.d.ts.map +1 -0
- package/dist/services/azure_pass_through.js +107 -0
- package/dist/services/azure_pass_through.js.map +1 -0
- package/dist/services/batch.d.ts +165 -0
- package/dist/services/batch.d.ts.map +1 -0
- package/dist/services/batch.js +265 -0
- package/dist/services/batch.js.map +1 -0
- package/dist/services/bedrock_pass_through.d.ts +70 -0
- package/dist/services/bedrock_pass_through.d.ts.map +1 -0
- package/dist/services/bedrock_pass_through.js +114 -0
- package/dist/services/bedrock_pass_through.js.map +1 -0
- package/dist/services/beta_agents.d.ts +199 -0
- package/dist/services/beta_agents.d.ts.map +1 -0
- package/dist/services/beta_agents.js +151 -0
- package/dist/services/beta_agents.js.map +1 -0
- package/dist/services/beta_mcp.d.ts +37 -0
- package/dist/services/beta_mcp.d.ts.map +1 -0
- package/dist/services/beta_mcp.js +40 -0
- package/dist/services/beta_mcp.js.map +1 -0
- package/dist/services/budget_management.d.ts +185 -0
- package/dist/services/budget_management.d.ts.map +1 -0
- package/dist/services/budget_management.js +196 -0
- package/dist/services/budget_management.js.map +1 -0
- package/dist/services/budget_spend_tracking.d.ts +967 -0
- package/dist/services/budget_spend_tracking.d.ts.map +1 -0
- package/dist/services/budget_spend_tracking.js +1103 -0
- package/dist/services/budget_spend_tracking.js.map +1 -0
- package/dist/services/cache_settings.d.ts +96 -0
- package/dist/services/cache_settings.d.ts.map +1 -0
- package/dist/services/cache_settings.js +95 -0
- package/dist/services/cache_settings.js.map +1 -0
- package/dist/services/caching.d.ts +54 -0
- package/dist/services/caching.d.ts.map +1 -0
- package/dist/services/caching.js +78 -0
- package/dist/services/caching.js.map +1 -0
- package/dist/services/chat_completions.d.ts +656 -0
- package/dist/services/chat_completions.d.ts.map +1 -0
- package/dist/services/chat_completions.js +590 -0
- package/dist/services/chat_completions.js.map +1 -0
- package/dist/services/claude_code_marketplace.d.ts +212 -0
- package/dist/services/claude_code_marketplace.d.ts.map +1 -0
- package/dist/services/claude_code_marketplace.js +248 -0
- package/dist/services/claude_code_marketplace.js.map +1 -0
- package/dist/services/cloudzero.d.ts +117 -0
- package/dist/services/cloudzero.d.ts.map +1 -0
- package/dist/services/cloudzero.js +130 -0
- package/dist/services/cloudzero.js.map +1 -0
- package/dist/services/cohere_pass_through.d.ts +70 -0
- package/dist/services/cohere_pass_through.d.ts.map +1 -0
- package/dist/services/cohere_pass_through.js +112 -0
- package/dist/services/cohere_pass_through.js.map +1 -0
- package/dist/services/completions.d.ts +59 -0
- package/dist/services/completions.d.ts.map +1 -0
- package/dist/services/completions.js +98 -0
- package/dist/services/completions.js.map +1 -0
- package/dist/services/compliance.d.ts +66 -0
- package/dist/services/compliance.d.ts.map +1 -0
- package/dist/services/compliance.js +74 -0
- package/dist/services/compliance.js.map +1 -0
- package/dist/services/config_overrides.d.ts +157 -0
- package/dist/services/config_overrides.d.ts.map +1 -0
- package/dist/services/config_overrides.js +207 -0
- package/dist/services/config_overrides.js.map +1 -0
- package/dist/services/config_yaml.d.ts +647 -0
- package/dist/services/config_yaml.d.ts.map +1 -0
- package/dist/services/config_yaml.js +504 -0
- package/dist/services/config_yaml.js.map +1 -0
- package/dist/services/containers.d.ts +215 -0
- package/dist/services/containers.d.ts.map +1 -0
- package/dist/services/containers.js +416 -0
- package/dist/services/containers.js.map +1 -0
- package/dist/services/coordination_redis_settings.d.ts +93 -0
- package/dist/services/coordination_redis_settings.d.ts.map +1 -0
- package/dist/services/coordination_redis_settings.js +104 -0
- package/dist/services/coordination_redis_settings.js.map +1 -0
- package/dist/services/cost_tracking.d.ts +140 -0
- package/dist/services/cost_tracking.d.ts.map +1 -0
- package/dist/services/cost_tracking.js +181 -0
- package/dist/services/cost_tracking.js.map +1 -0
- package/dist/services/credential_management.d.ts +133 -0
- package/dist/services/credential_management.d.ts.map +1 -0
- package/dist/services/credential_management.js +198 -0
- package/dist/services/credential_management.js.map +1 -0
- package/dist/services/cursor_pass_through.d.ts +70 -0
- package/dist/services/cursor_pass_through.d.ts.map +1 -0
- package/dist/services/cursor_pass_through.js +112 -0
- package/dist/services/cursor_pass_through.js.map +1 -0
- package/dist/services/customer_management.d.ts +545 -0
- package/dist/services/customer_management.d.ts.map +1 -0
- package/dist/services/customer_management.js +567 -0
- package/dist/services/customer_management.js.map +1 -0
- package/dist/services/email_management.d.ts +57 -0
- package/dist/services/email_management.d.ts.map +1 -0
- package/dist/services/email_management.js +79 -0
- package/dist/services/email_management.js.map +1 -0
- package/dist/services/embeddings.d.ts +155 -0
- package/dist/services/embeddings.d.ts.map +1 -0
- package/dist/services/embeddings.js +168 -0
- package/dist/services/embeddings.js.map +1 -0
- package/dist/services/evals.d.ts +245 -0
- package/dist/services/evals.d.ts.map +1 -0
- package/dist/services/evals.js +292 -0
- package/dist/services/evals.js.map +1 -0
- package/dist/services/experimental.d.ts +166 -0
- package/dist/services/experimental.d.ts.map +1 -0
- package/dist/services/experimental.js +265 -0
- package/dist/services/experimental.js.map +1 -0
- package/dist/services/fallback_management.d.ts +91 -0
- package/dist/services/fallback_management.d.ts.map +1 -0
- package/dist/services/fallback_management.js +86 -0
- package/dist/services/fallback_management.js.map +1 -0
- package/dist/services/files.d.ts +219 -0
- package/dist/services/files.d.ts.map +1 -0
- package/dist/services/files.js +358 -0
- package/dist/services/files.js.map +1 -0
- package/dist/services/fine_tuning.d.ts +155 -0
- package/dist/services/fine_tuning.d.ts.map +1 -0
- package/dist/services/fine_tuning.js +232 -0
- package/dist/services/fine_tuning.js.map +1 -0
- package/dist/services/gemini_agents.d.ts +68 -0
- package/dist/services/gemini_agents.d.ts.map +1 -0
- package/dist/services/gemini_agents.js +110 -0
- package/dist/services/gemini_agents.js.map +1 -0
- package/dist/services/google_ai_studio_pass_through.d.ts +70 -0
- package/dist/services/google_ai_studio_pass_through.d.ts.map +1 -0
- package/dist/services/google_ai_studio_pass_through.js +112 -0
- package/dist/services/google_ai_studio_pass_through.js.map +1 -0
- package/dist/services/google_genai_endpoints.d.ts +174 -0
- package/dist/services/google_genai_endpoints.d.ts.map +1 -0
- package/dist/services/google_genai_endpoints.js +340 -0
- package/dist/services/google_genai_endpoints.js.map +1 -0
- package/dist/services/guardrails.d.ts +1221 -0
- package/dist/services/guardrails.d.ts.map +1 -0
- package/dist/services/guardrails.js +1087 -0
- package/dist/services/guardrails.js.map +1 -0
- package/dist/services/health.d.ts +212 -0
- package/dist/services/health.d.ts.map +1 -0
- package/dist/services/health.js +309 -0
- package/dist/services/health.js.map +1 -0
- package/dist/services/images.d.ts +117 -0
- package/dist/services/images.d.ts.map +1 -0
- package/dist/services/images.js +184 -0
- package/dist/services/images.js.map +1 -0
- package/dist/services/index.d.ts +106 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +107 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/internal_user_management.d.ts +1062 -0
- package/dist/services/internal_user_management.d.ts.map +1 -0
- package/dist/services/internal_user_management.js +850 -0
- package/dist/services/internal_user_management.js.map +1 -0
- package/dist/services/invite_links.d.ts +56 -0
- package/dist/services/invite_links.d.ts.map +1 -0
- package/dist/services/invite_links.js +82 -0
- package/dist/services/invite_links.js.map +1 -0
- package/dist/services/jwt_mappings.d.ts +79 -0
- package/dist/services/jwt_mappings.d.ts.map +1 -0
- package/dist/services/jwt_mappings.js +116 -0
- package/dist/services/jwt_mappings.js.map +1 -0
- package/dist/services/key_management.d.ts +1640 -0
- package/dist/services/key_management.d.ts.map +1 -0
- package/dist/services/key_management.js +1344 -0
- package/dist/services/key_management.js.map +1 -0
- package/dist/services/langfuse_passthrough.d.ts +70 -0
- package/dist/services/langfuse_passthrough.d.ts.map +1 -0
- package/dist/services/langfuse_passthrough.js +114 -0
- package/dist/services/langfuse_passthrough.js.map +1 -0
- package/dist/services/llm_utils.d.ts +101 -0
- package/dist/services/llm_utils.d.ts.map +1 -0
- package/dist/services/llm_utils.js +110 -0
- package/dist/services/llm_utils.js.map +1 -0
- package/dist/services/logging_callbacks.d.ts +33 -0
- package/dist/services/logging_callbacks.d.ts.map +1 -0
- package/dist/services/logging_callbacks.js +46 -0
- package/dist/services/logging_callbacks.js.map +1 -0
- package/dist/services/mcp_byok_oauth.d.ts +112 -0
- package/dist/services/mcp_byok_oauth.d.ts.map +1 -0
- package/dist/services/mcp_byok_oauth.js +226 -0
- package/dist/services/mcp_byok_oauth.js.map +1 -0
- package/dist/services/mcp_discoverable.d.ts +197 -0
- package/dist/services/mcp_discoverable.d.ts.map +1 -0
- package/dist/services/mcp_discoverable.js +304 -0
- package/dist/services/mcp_discoverable.js.map +1 -0
- package/dist/services/mcp_management.d.ts +956 -0
- package/dist/services/mcp_management.d.ts.map +1 -0
- package/dist/services/mcp_management.js +1139 -0
- package/dist/services/mcp_management.js.map +1 -0
- package/dist/services/mcp_rest.d.ts +281 -0
- package/dist/services/mcp_rest.d.ts.map +1 -0
- package/dist/services/mcp_rest.js +269 -0
- package/dist/services/mcp_rest.js.map +1 -0
- package/dist/services/memory_management.d.ts +93 -0
- package/dist/services/memory_management.d.ts.map +1 -0
- package/dist/services/memory_management.js +117 -0
- package/dist/services/memory_management.js.map +1 -0
- package/dist/services/milvus_pass_through.d.ts +70 -0
- package/dist/services/milvus_pass_through.d.ts.map +1 -0
- package/dist/services/milvus_pass_through.js +112 -0
- package/dist/services/milvus_pass_through.js.map +1 -0
- package/dist/services/misc.d.ts +676 -0
- package/dist/services/misc.d.ts.map +1 -0
- package/dist/services/misc.js +954 -0
- package/dist/services/misc.js.map +1 -0
- package/dist/services/mistral_pass_through.d.ts +70 -0
- package/dist/services/mistral_pass_through.d.ts.map +1 -0
- package/dist/services/mistral_pass_through.js +114 -0
- package/dist/services/mistral_pass_through.js.map +1 -0
- package/dist/services/model_management.d.ts +1649 -0
- package/dist/services/model_management.d.ts.map +1 -0
- package/dist/services/model_management.js +1805 -0
- package/dist/services/model_management.js.map +1 -0
- package/dist/services/moderations.d.ts +25 -0
- package/dist/services/moderations.d.ts.map +1 -0
- package/dist/services/moderations.js +39 -0
- package/dist/services/moderations.js.map +1 -0
- package/dist/services/ocr.d.ts +25 -0
- package/dist/services/ocr.d.ts.map +1 -0
- package/dist/services/ocr.js +39 -0
- package/dist/services/ocr.js.map +1 -0
- package/dist/services/open_ai_pass_through.d.ts +125 -0
- package/dist/services/open_ai_pass_through.d.ts.map +1 -0
- package/dist/services/open_ai_pass_through.js +232 -0
- package/dist/services/open_ai_pass_through.js.map +1 -0
- package/dist/services/organization_management.d.ts +664 -0
- package/dist/services/organization_management.d.ts.map +1 -0
- package/dist/services/organization_management.js +644 -0
- package/dist/services/organization_management.js.map +1 -0
- package/dist/services/plugins.d.ts +106 -0
- package/dist/services/plugins.d.ts.map +1 -0
- package/dist/services/plugins.js +180 -0
- package/dist/services/plugins.js.map +1 -0
- package/dist/services/policies.d.ts +618 -0
- package/dist/services/policies.d.ts.map +1 -0
- package/dist/services/policies.js +616 -0
- package/dist/services/policies.js.map +1 -0
- package/dist/services/policy_engine.d.ts +483 -0
- package/dist/services/policy_engine.d.ts.map +1 -0
- package/dist/services/policy_engine.js +501 -0
- package/dist/services/policy_engine.js.map +1 -0
- package/dist/services/project_management.d.ts +356 -0
- package/dist/services/project_management.d.ts.map +1 -0
- package/dist/services/project_management.js +318 -0
- package/dist/services/project_management.js.map +1 -0
- package/dist/services/prompts.d.ts +193 -0
- package/dist/services/prompts.d.ts.map +1 -0
- package/dist/services/prompts.js +260 -0
- package/dist/services/prompts.js.map +1 -0
- package/dist/services/public.d.ts +300 -0
- package/dist/services/public.d.ts.map +1 -0
- package/dist/services/public.js +362 -0
- package/dist/services/public.js.map +1 -0
- package/dist/services/rag.d.ts +45 -0
- package/dist/services/rag.d.ts.map +1 -0
- package/dist/services/rag.js +71 -0
- package/dist/services/rag.js.map +1 -0
- package/dist/services/realtime.d.ts +91 -0
- package/dist/services/realtime.d.ts.map +1 -0
- package/dist/services/realtime.js +164 -0
- package/dist/services/realtime.js.map +1 -0
- package/dist/services/rerank.d.ts +35 -0
- package/dist/services/rerank.d.ts.map +1 -0
- package/dist/services/rerank.js +55 -0
- package/dist/services/rerank.js.map +1 -0
- package/dist/services/responses.d.ts +237 -0
- package/dist/services/responses.d.ts.map +1 -0
- package/dist/services/responses.js +445 -0
- package/dist/services/responses.js.map +1 -0
- package/dist/services/router_settings.d.ts +67 -0
- package/dist/services/router_settings.d.ts.map +1 -0
- package/dist/services/router_settings.js +63 -0
- package/dist/services/router_settings.js.map +1 -0
- package/dist/services/rust_control_plane.d.ts +52 -0
- package/dist/services/rust_control_plane.d.ts.map +1 -0
- package/dist/services/rust_control_plane.js +54 -0
- package/dist/services/rust_control_plane.js.map +1 -0
- package/dist/services/scim.d.ts +412 -0
- package/dist/services/scim.d.ts.map +1 -0
- package/dist/services/scim.js +519 -0
- package/dist/services/scim.js.map +1 -0
- package/dist/services/search.d.ts +79 -0
- package/dist/services/search.d.ts.map +1 -0
- package/dist/services/search.js +122 -0
- package/dist/services/search.js.map +1 -0
- package/dist/services/search_tools.d.ts +140 -0
- package/dist/services/search_tools.d.ts.map +1 -0
- package/dist/services/search_tools.js +201 -0
- package/dist/services/search_tools.js.map +1 -0
- package/dist/services/settings.d.ts +53 -0
- package/dist/services/settings.d.ts.map +1 -0
- package/dist/services/settings.js +67 -0
- package/dist/services/settings.js.map +1 -0
- package/dist/services/sso_settings.d.ts +239 -0
- package/dist/services/sso_settings.d.ts.map +1 -0
- package/dist/services/sso_settings.js +214 -0
- package/dist/services/sso_settings.js.map +1 -0
- package/dist/services/tag_management.d.ts +390 -0
- package/dist/services/tag_management.d.ts.map +1 -0
- package/dist/services/tag_management.js +407 -0
- package/dist/services/tag_management.js.map +1 -0
- package/dist/services/team_management.d.ts +1502 -0
- package/dist/services/team_management.d.ts.map +1 -0
- package/dist/services/team_management.js +1429 -0
- package/dist/services/team_management.js.map +1 -0
- package/dist/services/tools.d.ts +227 -0
- package/dist/services/tools.d.ts.map +1 -0
- package/dist/services/tools.js +266 -0
- package/dist/services/tools.js.map +1 -0
- package/dist/services/ui_settings.d.ts +90 -0
- package/dist/services/ui_settings.d.ts.map +1 -0
- package/dist/services/ui_settings.js +96 -0
- package/dist/services/ui_settings.js.map +1 -0
- package/dist/services/ui_theme_settings.d.ts +62 -0
- package/dist/services/ui_theme_settings.d.ts.map +1 -0
- package/dist/services/ui_theme_settings.js +79 -0
- package/dist/services/ui_theme_settings.js.map +1 -0
- package/dist/services/usage_ai.d.ts +39 -0
- package/dist/services/usage_ai.d.ts.map +1 -0
- package/dist/services/usage_ai.js +40 -0
- package/dist/services/usage_ai.js.map +1 -0
- package/dist/services/vantage.d.ts +108 -0
- package/dist/services/vantage.d.ts.map +1 -0
- package/dist/services/vantage.js +124 -0
- package/dist/services/vantage.js.map +1 -0
- package/dist/services/vector_store_management.d.ts +161 -0
- package/dist/services/vector_store_management.d.ts.map +1 -0
- package/dist/services/vector_store_management.js +191 -0
- package/dist/services/vector_store_management.js.map +1 -0
- package/dist/services/vector_stores.d.ts +342 -0
- package/dist/services/vector_stores.d.ts.map +1 -0
- package/dist/services/vector_stores.js +639 -0
- package/dist/services/vector_stores.js.map +1 -0
- package/dist/services/vertex_ai_pass_through.d.ts +180 -0
- package/dist/services/vertex_ai_pass_through.d.ts.map +1 -0
- package/dist/services/vertex_ai_pass_through.js +334 -0
- package/dist/services/vertex_ai_pass_through.js.map +1 -0
- package/dist/services/videos.d.ts +207 -0
- package/dist/services/videos.d.ts.map +1 -0
- package/dist/services/videos.js +373 -0
- package/dist/services/videos.js.map +1 -0
- package/dist/services/vllm_pass_through.d.ts +70 -0
- package/dist/services/vllm_pass_through.d.ts.map +1 -0
- package/dist/services/vllm_pass_through.js +104 -0
- package/dist/services/vllm_pass_through.js.map +1 -0
- package/dist/services/watsonx_pass_through.d.ts +70 -0
- package/dist/services/watsonx_pass_through.d.ts.map +1 -0
- package/dist/services/watsonx_pass_through.js +114 -0
- package/dist/services/watsonx_pass_through.js.map +1 -0
- package/dist/services/web_socket.d.ts +77 -0
- package/dist/services/web_socket.d.ts.map +1 -0
- package/dist/services/web_socket.js +135 -0
- package/dist/services/web_socket.js.map +1 -0
- package/dist/services/workflow_management.d.ts +140 -0
- package/dist/services/workflow_management.d.ts.map +1 -0
- package/dist/services/workflow_management.js +220 -0
- package/dist/services/workflow_management.js.map +1 -0
- package/dist/traits.d.ts +14 -0
- package/dist/traits.d.ts.map +1 -0
- package/dist/traits.js +15 -0
- package/dist/traits.js.map +1 -0
- package/package.json +75 -0
- package/src/credentials.ts +97 -0
- package/src/errors.ts +108 -0
- package/src/index.ts +33 -0
- package/src/protocol.ts +160 -0
- package/src/retry.ts +74 -0
- package/src/services/a2a.ts +250 -0
- package/src/services/a2a_registration.ts +94 -0
- package/src/services/access_groups.ts +716 -0
- package/src/services/adaptive_router.ts +49 -0
- package/src/services/agents.ts +1314 -0
- package/src/services/alerting.ts +49 -0
- package/src/services/anthropic_pass_through.ts +233 -0
- package/src/services/anthropic_passthrough.ts +123 -0
- package/src/services/anthropic_skills.ts +200 -0
- package/src/services/assembly_ai_eu_pass_through.ts +237 -0
- package/src/services/assembly_ai_pass_through.ts +237 -0
- package/src/services/assistants.ts +685 -0
- package/src/services/audio.ts +189 -0
- package/src/services/audit_logging.ts +194 -0
- package/src/services/auto_router.ts +625 -0
- package/src/services/aws_comprehend_medical_pass_through.ts +109 -0
- package/src/services/azure_ai_pass_through.ts +231 -0
- package/src/services/azure_pass_through.ts +227 -0
- package/src/services/batch.ts +553 -0
- package/src/services/bedrock_pass_through.ts +229 -0
- package/src/services/beta_agents.ts +444 -0
- package/src/services/beta_mcp.ts +105 -0
- package/src/services/budget_management.ts +465 -0
- package/src/services/budget_spend_tracking.ts +2670 -0
- package/src/services/cache_settings.ts +234 -0
- package/src/services/caching.ts +175 -0
- package/src/services/chat_completions.ts +1788 -0
- package/src/services/claude_code_marketplace.ts +569 -0
- package/src/services/cloudzero.ts +297 -0
- package/src/services/cohere_pass_through.ts +227 -0
- package/src/services/completions.ts +194 -0
- package/src/services/compliance.ts +175 -0
- package/src/services/config_overrides.ts +466 -0
- package/src/services/config_yaml.ts +1537 -0
- package/src/services/containers.ts +848 -0
- package/src/services/coordination_redis_settings.ts +251 -0
- package/src/services/cost_tracking.ts +407 -0
- package/src/services/credential_management.ts +436 -0
- package/src/services/cursor_pass_through.ts +227 -0
- package/src/services/customer_management.ts +1475 -0
- package/src/services/email_management.ts +171 -0
- package/src/services/embeddings.ts +424 -0
- package/src/services/evals.ts +672 -0
- package/src/services/experimental.ts +572 -0
- package/src/services/fallback_management.ts +224 -0
- package/src/services/files.ts +732 -0
- package/src/services/fine_tuning.ts +547 -0
- package/src/services/gemini_agents.ts +227 -0
- package/src/services/google_ai_studio_pass_through.ts +227 -0
- package/src/services/google_genai_endpoints.ts +688 -0
- package/src/services/guardrails.ts +3006 -0
- package/src/services/health.ts +713 -0
- package/src/services/images.ts +430 -0
- package/src/services/index.ts +106 -0
- package/src/services/internal_user_management.ts +2574 -0
- package/src/services/invite_links.ts +167 -0
- package/src/services/jwt_mappings.ts +238 -0
- package/src/services/key_management.ts +4162 -0
- package/src/services/langfuse_passthrough.ts +231 -0
- package/src/services/llm_utils.ts +429 -0
- package/src/services/logging_callbacks.ts +104 -0
- package/src/services/mcp_byok_oauth.ts +468 -0
- package/src/services/mcp_discoverable.ts +626 -0
- package/src/services/mcp_management.ts +2915 -0
- package/src/services/mcp_rest.ts +779 -0
- package/src/services/memory_management.ts +248 -0
- package/src/services/milvus_pass_through.ts +227 -0
- package/src/services/misc.ts +2128 -0
- package/src/services/mistral_pass_through.ts +229 -0
- package/src/services/model_management.ts +4501 -0
- package/src/services/moderations.ts +80 -0
- package/src/services/ocr.ts +78 -0
- package/src/services/open_ai_pass_through.ts +462 -0
- package/src/services/organization_management.ts +1749 -0
- package/src/services/plugins.ts +367 -0
- package/src/services/policies.ts +1676 -0
- package/src/services/policy_engine.ts +1318 -0
- package/src/services/project_management.ts +938 -0
- package/src/services/prompts.ts +592 -0
- package/src/services/public.ts +880 -0
- package/src/services/rag.ts +148 -0
- package/src/services/realtime.ts +350 -0
- package/src/services/rerank.ts +111 -0
- package/src/services/responses.ts +909 -0
- package/src/services/router_settings.ts +168 -0
- package/src/services/rust_control_plane.ts +123 -0
- package/src/services/scim.ts +1243 -0
- package/src/services/search.ts +260 -0
- package/src/services/search_tools.ts +439 -0
- package/src/services/settings.ts +146 -0
- package/src/services/sso_settings.ts +626 -0
- package/src/services/tag_management.ts +1004 -0
- package/src/services/team_management.ts +3990 -0
- package/src/services/tools.ts +628 -0
- package/src/services/ui_settings.ts +237 -0
- package/src/services/ui_theme_settings.ts +173 -0
- package/src/services/usage_ai.ts +86 -0
- package/src/services/vantage.ts +283 -0
- package/src/services/vector_store_management.ts +454 -0
- package/src/services/vector_stores.ts +1321 -0
- package/src/services/vertex_ai_pass_through.ts +684 -0
- package/src/services/videos.ts +762 -0
- package/src/services/vllm_pass_through.ts +227 -0
- package/src/services/watsonx_pass_through.ts +229 -0
- package/src/services/web_socket.ts +254 -0
- package/src/services/workflow_management.ts +482 -0
- package/src/traits.ts +44 -0
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@homeflare/distilled-litellm",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Interim npm home for @distilled.cloud/litellm — see docs/distilled-interim.md. Not published upstream yet; the kit aliases @distilled.cloud/litellm onto this package until it is.",
|
|
5
|
+
"homepage": "https://github.com/taslabs-net/homeflare-kit/tree/main/packages/distilled-litellm#readme",
|
|
6
|
+
"bugs": "https://github.com/taslabs-net/homeflare-kit/issues",
|
|
7
|
+
"license": "Apache-2.0",
|
|
8
|
+
"author": "Timothy Schneider",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/taslabs-net/homeflare-kit.git",
|
|
12
|
+
"directory": "packages/distilled-litellm"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"src",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"type": "module",
|
|
21
|
+
"sideEffects": false,
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"bun": "./src/index.ts",
|
|
26
|
+
"worker": "./src/index.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
},
|
|
29
|
+
"./Credentials": {
|
|
30
|
+
"types": "./dist/credentials.d.ts",
|
|
31
|
+
"bun": "./src/credentials.ts",
|
|
32
|
+
"worker": "./src/credentials.ts",
|
|
33
|
+
"default": "./dist/credentials.js"
|
|
34
|
+
},
|
|
35
|
+
"./Errors": {
|
|
36
|
+
"types": "./dist/errors.d.ts",
|
|
37
|
+
"bun": "./src/errors.ts",
|
|
38
|
+
"worker": "./src/errors.ts",
|
|
39
|
+
"default": "./dist/errors.js"
|
|
40
|
+
},
|
|
41
|
+
"./Traits": {
|
|
42
|
+
"types": "./dist/traits.d.ts",
|
|
43
|
+
"bun": "./src/traits.ts",
|
|
44
|
+
"worker": "./src/traits.ts",
|
|
45
|
+
"default": "./dist/traits.js"
|
|
46
|
+
},
|
|
47
|
+
"./Protocol": {
|
|
48
|
+
"types": "./dist/protocol.d.ts",
|
|
49
|
+
"bun": "./src/protocol.ts",
|
|
50
|
+
"worker": "./src/protocol.ts",
|
|
51
|
+
"default": "./dist/protocol.js"
|
|
52
|
+
},
|
|
53
|
+
"./Retry": {
|
|
54
|
+
"types": "./dist/retry.d.ts",
|
|
55
|
+
"bun": "./src/retry.ts",
|
|
56
|
+
"worker": "./src/retry.ts",
|
|
57
|
+
"default": "./dist/retry.js"
|
|
58
|
+
},
|
|
59
|
+
"./*": {
|
|
60
|
+
"types": "./dist/services/*.d.ts",
|
|
61
|
+
"bun": "./src/services/*.ts",
|
|
62
|
+
"worker": "./src/services/*.ts",
|
|
63
|
+
"default": "./dist/services/*.js"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"@distilled.cloud/core": "1.0.0-rc.12"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"effect": "4.0.0-rc.115"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LiteLLM credentials — hand-written.
|
|
3
|
+
*
|
|
4
|
+
* The `Credentials` service resolves `{ apiKey, apiBaseUrl }` per request;
|
|
5
|
+
* the protocol layer formats the `Authorization: Bearer <apiKey>` header
|
|
6
|
+
* from it.
|
|
7
|
+
*
|
|
8
|
+
* LiteLLM Proxy is self-hosted, so — like Forgejo, and unlike a
|
|
9
|
+
* single-tenant SaaS — there is no default API root: the instance URL is
|
|
10
|
+
* part of the credential. `apiKey` is either the proxy's own master key
|
|
11
|
+
* (`general_settings.master_key` / `LITELLM_MASTER_KEY`) or a virtual key
|
|
12
|
+
* with the `proxy_admin` role — every `/key`, `/team`, `/user`, `/budget`,
|
|
13
|
+
* `/model` and `/config` mutation this package's services reach requires
|
|
14
|
+
* `user_api_key_dict.user_role == PROXY_ADMIN`
|
|
15
|
+
* (`litellm/proxy/auth/user_api_key_auth.py`, `proxy_server.py`'s
|
|
16
|
+
* `update_config_general_settings` at tag `v1.100.0` — see `protocol.ts`).
|
|
17
|
+
* A read-scoped virtual key can call the list/info GETs but every mutation
|
|
18
|
+
* answers `401` (LiteLLM does not distinguish "wrong key" from
|
|
19
|
+
* "right key, wrong role" — see `errors.ts`).
|
|
20
|
+
*/
|
|
21
|
+
import * as EffectConfig from "effect/Config";
|
|
22
|
+
import * as Context from "effect/Context";
|
|
23
|
+
import * as Effect from "effect/Effect";
|
|
24
|
+
import * as Layer from "effect/Layer";
|
|
25
|
+
import * as Redacted from "effect/Redacted";
|
|
26
|
+
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
27
|
+
|
|
28
|
+
export interface Config {
|
|
29
|
+
readonly apiKey: Redacted.Redacted<string>;
|
|
30
|
+
/** The proxy's origin, trailing slash stripped. No default — see the header. */
|
|
31
|
+
readonly apiBaseUrl: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class Credentials extends Context.Service<
|
|
35
|
+
Credentials,
|
|
36
|
+
Effect.Effect<Config>
|
|
37
|
+
>()("LitellmCredentials") {}
|
|
38
|
+
|
|
39
|
+
const normalizeBaseUrl = (baseUrl: string): string => {
|
|
40
|
+
// Linear on purpose: a `/\/+$/` regex backtracks polynomially on a long run of
|
|
41
|
+
// "/" that is not at the end (CodeQL js/polynomial-redos, the same defect
|
|
42
|
+
// NetBox's and Paperless-ngx's sibling SDKs already fixed for this identical
|
|
43
|
+
// helper), and this is caller input.
|
|
44
|
+
let end = baseUrl.length;
|
|
45
|
+
while (end > 0 && baseUrl.charCodeAt(end - 1) === 47) end--;
|
|
46
|
+
return baseUrl.slice(0, end);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const envConfig = EffectConfig.all({
|
|
50
|
+
// `LITELLM_PROXY_URL` / `LITELLM_PROXY_API_KEY` are the names LiteLLM's
|
|
51
|
+
// own `litellm` CLI client reads (`litellm/proxy/client/cli/main.py` at
|
|
52
|
+
// the tag) — using the vendor's own names means a consumer who already
|
|
53
|
+
// has a `.env` for the `litellm` CLI needs nothing new for this package.
|
|
54
|
+
apiKey: EffectConfig.String("LITELLM_PROXY_API_KEY"),
|
|
55
|
+
baseUrl: EffectConfig.String("LITELLM_PROXY_URL"),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const CredentialsFromEnv = Layer.succeed(
|
|
59
|
+
Credentials,
|
|
60
|
+
envConfig.pipe(
|
|
61
|
+
Effect.mapError(
|
|
62
|
+
() =>
|
|
63
|
+
new ConfigError({
|
|
64
|
+
message:
|
|
65
|
+
"LITELLM_PROXY_URL and LITELLM_PROXY_API_KEY environment variables are required",
|
|
66
|
+
}),
|
|
67
|
+
),
|
|
68
|
+
Effect.map(({ apiKey, baseUrl }) => ({
|
|
69
|
+
apiKey: Redacted.make(apiKey),
|
|
70
|
+
apiBaseUrl: normalizeBaseUrl(baseUrl),
|
|
71
|
+
})),
|
|
72
|
+
Effect.orDie,
|
|
73
|
+
),
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Convenience layer from a plain key and the proxy's origin.
|
|
78
|
+
*
|
|
79
|
+
* ⛔ THE KEY IS NEVER A PROP (house rule, S25 — Alchemy persists attributes
|
|
80
|
+
* unencrypted). A caller building this layer from a stack should read the
|
|
81
|
+
* key fresh from the environment/a secret store, never from committed
|
|
82
|
+
* state.
|
|
83
|
+
*/
|
|
84
|
+
export const credentials = (config: {
|
|
85
|
+
readonly apiKey: string | Redacted.Redacted<string>;
|
|
86
|
+
readonly baseUrl: string;
|
|
87
|
+
}): Layer.Layer<Credentials> =>
|
|
88
|
+
Layer.succeed(
|
|
89
|
+
Credentials,
|
|
90
|
+
Effect.succeed({
|
|
91
|
+
apiKey:
|
|
92
|
+
typeof config.apiKey === "string"
|
|
93
|
+
? Redacted.make(config.apiKey)
|
|
94
|
+
: config.apiKey,
|
|
95
|
+
apiBaseUrl: normalizeBaseUrl(config.baseUrl),
|
|
96
|
+
}),
|
|
97
|
+
);
|
package/src/errors.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LiteLLM-specific error types.
|
|
3
|
+
*
|
|
4
|
+
* Re-exports the common HTTP errors from core and adds the LiteLLM-specific
|
|
5
|
+
* unknown-error and parse-error wrappers.
|
|
6
|
+
*
|
|
7
|
+
* LiteLLM Proxy's failure envelope is genuinely heterogeneous — measured
|
|
8
|
+
* against the pinned `v1.100.0` source, NOT assumed from the spec (whose own
|
|
9
|
+
* `ErrorResponse` schema names only one of the real shapes). A `ProxyException`
|
|
10
|
+
* (`proxy_server.py`'s `openai_exception_handler` at the tag, the path a
|
|
11
|
+
* `router.py` "no healthy deployment" style failure funnels through) answers
|
|
12
|
+
* a BARE `{"error": {"message", "type", "param", "code"}}` — no `detail`
|
|
13
|
+
* wrapper at all. Plain FastAPI `HTTPException(status_code, detail=...)` —
|
|
14
|
+
* the dominant pattern across every `/key`, `/team`, `/user`, `/budget`,
|
|
15
|
+
* `/model` and `/config` route in `management_endpoints/*.py` — answers
|
|
16
|
+
* `{"detail": "<string>"}` OR `{"detail": {"error": ..., "message"?: ...}}`,
|
|
17
|
+
* NOT the `{"detail": [...]}` array `RequestValidationError` uses for 422
|
|
18
|
+
* (see `HTTPValidationError`/`ValidationError` in the vendor spec, decoded
|
|
19
|
+
* by core's shared `UnprocessableEntity`). See `protocol.ts`'s
|
|
20
|
+
* `errorEnvelope`/`messageFrom` for the exact extraction order — a sibling
|
|
21
|
+
* `message` field always wins over a short `error` code, verified against
|
|
22
|
+
* `litellm_pre_call_utils.py`'s `reject_url_valued_destination`. There is no
|
|
23
|
+
* machine-readable code on most routes (LiteLLM's own `code` field is
|
|
24
|
+
* usually the stringified status, e.g. `"400"`), so the SDK dispatches on
|
|
25
|
+
* the HTTP status: the per-operation classes generated from each
|
|
26
|
+
* operation's declared responses first, then core's shared status map, then
|
|
27
|
+
* {@link UnknownLitellmError}.
|
|
28
|
+
*
|
|
29
|
+
* ⛔ The vendor's own OpenAPI document (`litellm-openapi` @ 1.100.0, dumped
|
|
30
|
+
* by the vendor's own `gen-api-types.mjs` — see `scripts/convert.ts`)
|
|
31
|
+
* declares almost NO error responses beyond the FastAPI-automatic `422` —
|
|
32
|
+
* measured across all 696 paths, the only per-operation `400`/`401`/`403`/
|
|
33
|
+
* `404`/`408`/`429`/`500`/`503` declarations anywhere outside the
|
|
34
|
+
* `/openai/deployments/{model}/chat/completions` LLM-passthrough route are
|
|
35
|
+
* `GET /audit/{id}`'s `404`/`500` (both already in the spec — no patch
|
|
36
|
+
* needed). None of the admin surface this package's tag split covers
|
|
37
|
+
* (`model_management`, `key_management`, `team_management`,
|
|
38
|
+
* `internal_user_management`, `budget_management`, the untagged
|
|
39
|
+
* `/config/pass_through_endpoint*` family) declares anything beyond `422`.
|
|
40
|
+
* `401`/`429`/`500`/`502`/`503`/`504` still typecheck on every operation —
|
|
41
|
+
* they ride the shared `LitellmOpError` union via core's
|
|
42
|
+
* `DEFAULT_ERROR_STATUSES` (see `protocol.ts`) — but a status OUTSIDE that
|
|
43
|
+
* default set (`400`, `403`, `404`, `409`, `423`) that the spec doesn't
|
|
44
|
+
* declare for a given operation would decode correctly at runtime (core's
|
|
45
|
+
* shared `HTTP_STATUS_MAP` fallback in `protocol-rest.ts` still maps it) but
|
|
46
|
+
* NOT appear in that operation's TypeScript error union — an untyped escape
|
|
47
|
+
* the Typed Error Doctrine exists to catch. `patches/misc/…json` fixes the
|
|
48
|
+
* one such case this package has vendor-source evidence for (see its own
|
|
49
|
+
* comment); the rest of the admin surface is unverified beyond the spec —
|
|
50
|
+
* see this package's README.
|
|
51
|
+
*/
|
|
52
|
+
export {
|
|
53
|
+
BadGateway,
|
|
54
|
+
BadRequest,
|
|
55
|
+
Conflict,
|
|
56
|
+
ConfigError,
|
|
57
|
+
Forbidden,
|
|
58
|
+
GatewayTimeout,
|
|
59
|
+
InternalServerError,
|
|
60
|
+
Locked,
|
|
61
|
+
NotFound,
|
|
62
|
+
ServiceUnavailable,
|
|
63
|
+
TooManyRequests,
|
|
64
|
+
Unauthorized,
|
|
65
|
+
UnprocessableEntity,
|
|
66
|
+
HTTP_STATUS_MAP,
|
|
67
|
+
DEFAULT_ERRORS,
|
|
68
|
+
API_ERRORS,
|
|
69
|
+
} from "@distilled.cloud/core/errors";
|
|
70
|
+
import type { DefaultErrors as CoreDefaultErrors } from "@distilled.cloud/core/errors";
|
|
71
|
+
|
|
72
|
+
import * as Schema from "effect/Schema";
|
|
73
|
+
import * as Category from "@distilled.cloud/core/category";
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Unknown LiteLLM error — returned when a failed response's HTTP status has
|
|
77
|
+
* no mapped error class, or the body doesn't match the `ProxyException`
|
|
78
|
+
* envelope. Carries the raw body for later cataloging.
|
|
79
|
+
*/
|
|
80
|
+
export class UnknownLitellmError extends Schema.TaggedError<UnknownLitellmError>()(
|
|
81
|
+
"UnknownLitellmError",
|
|
82
|
+
{
|
|
83
|
+
code: Schema.optional(Schema.String),
|
|
84
|
+
message: Schema.optional(Schema.String),
|
|
85
|
+
body: Schema.Unknown,
|
|
86
|
+
},
|
|
87
|
+
).pipe(Category.withServerError) {}
|
|
88
|
+
|
|
89
|
+
/** Schema parse error wrapper. */
|
|
90
|
+
export class LitellmParseError extends Schema.TaggedError<LitellmParseError>()(
|
|
91
|
+
"LitellmParseError",
|
|
92
|
+
{
|
|
93
|
+
body: Schema.Unknown,
|
|
94
|
+
cause: Schema.Unknown,
|
|
95
|
+
},
|
|
96
|
+
).pipe(Category.withParseError) {}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Errors any LiteLLM operation may surface in addition to the per-operation
|
|
100
|
+
* typed status errors.
|
|
101
|
+
*/
|
|
102
|
+
export type ClientErrors = UnknownLitellmError | LitellmParseError;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Default LiteLLM operation errors: the shared HTTP status errors from core
|
|
106
|
+
* plus the client-level fallback/decode errors.
|
|
107
|
+
*/
|
|
108
|
+
export type DefaultErrors = CoreDefaultErrors | ClientErrors;
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @distilled.cloud/litellm — LiteLLM Proxy admin API SDK for Effect.
|
|
3
|
+
*
|
|
4
|
+
* `./services` is generated by `scripts/generate.ts` from the Smithy models in
|
|
5
|
+
* `.generated-specs` (written by `scripts/convert.ts` from LiteLLM's pinned
|
|
6
|
+
* `app.openapi()` document, tag v1.100.0 — see README.md). Everything else
|
|
7
|
+
* in this folder is hand-written.
|
|
8
|
+
*
|
|
9
|
+
* One module per LiteLLM OpenAPI tag — `model_management`, `key_management`,
|
|
10
|
+
* `team_management`, `internal_user_management`, `budget_management`,
|
|
11
|
+
* `misc` (the untagged `/config/pass_through_endpoint*` family and other
|
|
12
|
+
* UI/debug/login/MCP routes), … — the same split LiteLLM's own API
|
|
13
|
+
* reference groups by. See README.md for the full tag → admin-surface map.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* import * as Litellm from "@distilled.cloud/litellm";
|
|
18
|
+
*
|
|
19
|
+
* const key = yield* Litellm.Services.keyManagement.generateKeyFn({
|
|
20
|
+
* key_alias: "my-service",
|
|
21
|
+
* });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export * from "./credentials.ts";
|
|
25
|
+
export * from "./errors.ts";
|
|
26
|
+
export * as T from "./traits.ts";
|
|
27
|
+
export {
|
|
28
|
+
LitellmProtocol,
|
|
29
|
+
type LitellmOpError,
|
|
30
|
+
type LitellmOpContext,
|
|
31
|
+
} from "./protocol.ts";
|
|
32
|
+
export * as Retry from "./retry.ts";
|
|
33
|
+
export * as Services from "./services/index.ts";
|
package/src/protocol.ts
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LitellmProtocol — the shared bearer-REST protocol instantiated for
|
|
3
|
+
* LiteLLM Proxy.
|
|
4
|
+
*
|
|
5
|
+
* LiteLLM speaks plain JSON with no consistent success envelope — some
|
|
6
|
+
* responses are the resource itself, others wrap a list in a named field
|
|
7
|
+
* (`{"keys": [...]}`, `{"endpoints": [...]}`) per-resource, decoded by each
|
|
8
|
+
* operation's own generated schema, not by this protocol.
|
|
9
|
+
*
|
|
10
|
+
* Authentication: `Authorization: Bearer <key>` — LiteLLM's own `litellm`
|
|
11
|
+
* CLI client uses it (`litellm/proxy/client/cli/main.py` at tag v1.100.0),
|
|
12
|
+
* and every `/key`, `/team`, `/user`, `/budget`, `/model` and `/config`
|
|
13
|
+
* route's `Depends(user_api_key_auth)` accepts it. ⚠️ VERIFIED AGAINST THE
|
|
14
|
+
* SPEC, AND FOUND WRONG: the vendor's own OpenAPI document (`litellm-openapi`
|
|
15
|
+
* @ 1.100.0) declares exactly one `securitySchemes` entry —
|
|
16
|
+
* `APIKeyHeader` (`type: apiKey`, `in: header`, `name: x-litellm-api-key`,
|
|
17
|
+
* `description: "Bearer token"`) — not a `Bearer`/`http`-scheme security
|
|
18
|
+
* requirement, and no operation references it (`security` is `null` at the
|
|
19
|
+
* document root and on every operation). FastAPI's OpenAPI generator only
|
|
20
|
+
* introspects a route's declared `Security()`/`Depends()` dependency for
|
|
21
|
+
* the scheme it documents; `user_api_key_auth` accepts an `Authorization:
|
|
22
|
+
* Bearer <key>` header by reading it directly out of the request in Python
|
|
23
|
+
* (not through a `Security(APIKeyHeader(...))` FastAPI can introspect), so
|
|
24
|
+
* the spec's own securityScheme names a header LiteLLM's docs, CLI and this
|
|
25
|
+
* package do not actually send. `Bearer` is used here because it is what
|
|
26
|
+
* the vendor's own client sends and what homeflare's existing
|
|
27
|
+
* `packages/alchemy/src/litellm/client.ts` already verified works — the
|
|
28
|
+
* spec is necessary input, not sufficient, exactly the case the Typed Error
|
|
29
|
+
* Doctrine exists for.
|
|
30
|
+
*
|
|
31
|
+
* Failure envelope: heterogeneous, measured against the pinned v1.100.0
|
|
32
|
+
* source (`litellm/proxy/proxy_server.py`'s `ProxyException` handler at the
|
|
33
|
+
* tag, and every `management_endpoints/*.py` file) — see `errorEnvelope`
|
|
34
|
+
* below and `errors.ts`'s header for the two shapes and why.
|
|
35
|
+
*
|
|
36
|
+
* Pagination: ad hoc per resource (`page`/`size` on some list routes,
|
|
37
|
+
* `offset`/`limit` on others), no shared cursor/token — see
|
|
38
|
+
* `scripts/generate.ts`.
|
|
39
|
+
*/
|
|
40
|
+
import * as Effect from "effect/Effect";
|
|
41
|
+
import type * as Layer from "effect/Layer";
|
|
42
|
+
import * as Redacted from "effect/Redacted";
|
|
43
|
+
import type * as HttpClient from "effect/unstable/http/HttpClient";
|
|
44
|
+
import type * as HttpClientError from "effect/unstable/http/HttpClientError";
|
|
45
|
+
import type * as API from "@distilled.cloud/core/api";
|
|
46
|
+
import type { ConfigError } from "@distilled.cloud/core/errors";
|
|
47
|
+
import {
|
|
48
|
+
makeRestProtocol,
|
|
49
|
+
type RestErrorEnvelope,
|
|
50
|
+
} from "@distilled.cloud/core/protocol-rest";
|
|
51
|
+
import { Credentials, type Config } from "./credentials.ts";
|
|
52
|
+
import { UnknownLitellmError, type DefaultErrors } from "./errors.ts";
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Error channel shared by every generated LiteLLM operation. Generated
|
|
56
|
+
* service files annotate operations with `API.OperationMethod<I, O,
|
|
57
|
+
* LitellmOpError, LitellmOpContext>` explicitly so the compiler never
|
|
58
|
+
* infers these back out of the schema generics.
|
|
59
|
+
*/
|
|
60
|
+
export type LitellmOpError =
|
|
61
|
+
| DefaultErrors
|
|
62
|
+
| ConfigError
|
|
63
|
+
| HttpClientError.HttpClientError;
|
|
64
|
+
|
|
65
|
+
/** Context (requirements) shared by every generated LiteLLM operation. */
|
|
66
|
+
export type LitellmOpContext = Credentials | HttpClient.HttpClient;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Extract `{ message, code }` from a failed response body. Two real shapes,
|
|
70
|
+
* both observed in the pinned source (see this file's header):
|
|
71
|
+
*
|
|
72
|
+
* 1. A genuine `ProxyException` (`proxy_server.py`'s
|
|
73
|
+
* `openai_exception_handler`): `{"error": {"message", "type", "param",
|
|
74
|
+
* "code"}}` — no `detail` wrapper at all.
|
|
75
|
+
* 2. Plain FastAPI `HTTPException(status_code, detail=...)` — the vast
|
|
76
|
+
* majority of raises across `key_management_endpoints.py`,
|
|
77
|
+
* `team_endpoints.py`, `internal_user_endpoints.py`,
|
|
78
|
+
* `budget_management_endpoints.py`, `model_management_endpoints.py`,
|
|
79
|
+
* `pass_through_endpoints.py` and `litellm_pre_call_utils.py` — where
|
|
80
|
+
* `detail` is EITHER a plain string (`detail=f"..."`) →
|
|
81
|
+
* `{"detail": "<string>"}`, OR a dict shaped one of two ways:
|
|
82
|
+
* `{"error": "<full sentence>"}` (the common `budget_management_endpoints.py`
|
|
83
|
+
* shape — the whole message IS the `error` field), or an OpenAI-triple
|
|
84
|
+
* `{"error": "<short code>", "message": "<full sentence>", "param": ...}`
|
|
85
|
+
* (`litellm_pre_call_utils.py`'s `reject_url_valued_destination`, hit on
|
|
86
|
+
* EVERY proxied LLM call via `add_litellm_data_to_request` — not a corner
|
|
87
|
+
* case). ⚠️ MEASURED: when both `message` and `error` are present on the
|
|
88
|
+
* SAME object, `error` is a short code (`"invalid_request"`) and
|
|
89
|
+
* `message` is the human-readable text — `message` must win, or a real,
|
|
90
|
+
* actionable error collapses to a code word. There is no consistent
|
|
91
|
+
* machine-readable `code` on this path — `code` is only ever a
|
|
92
|
+
* `ProxyException`'s stringified HTTP status, so it is not threaded
|
|
93
|
+
* through here.
|
|
94
|
+
*/
|
|
95
|
+
const messageFrom = (v: unknown): string | undefined => {
|
|
96
|
+
if (v === null || typeof v !== "object" || Array.isArray(v)) {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
const o = v as Record<string, unknown>;
|
|
100
|
+
// A sibling `message` always wins over a short `error` code — see this
|
|
101
|
+
// function's header (the `reject_url_valued_destination` shape).
|
|
102
|
+
if (typeof o.message === "string") return o.message;
|
|
103
|
+
if (typeof o.error === "string") return o.error;
|
|
104
|
+
if (
|
|
105
|
+
o.error !== null &&
|
|
106
|
+
typeof o.error === "object" &&
|
|
107
|
+
!Array.isArray(o.error)
|
|
108
|
+
) {
|
|
109
|
+
const inner = o.error as Record<string, unknown>;
|
|
110
|
+
if (typeof inner.message === "string") return inner.message;
|
|
111
|
+
}
|
|
112
|
+
return undefined;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const errorEnvelope = (body: unknown): RestErrorEnvelope | undefined => {
|
|
116
|
+
if (body === null || typeof body !== "object") return undefined;
|
|
117
|
+
const b = body as Record<string, unknown>;
|
|
118
|
+
|
|
119
|
+
// Shape 1: a bare ProxyException envelope, or a top-level string `error`
|
|
120
|
+
// (defensive — not observed, but cheap to accept).
|
|
121
|
+
if (typeof b.error === "string") return { message: b.error };
|
|
122
|
+
const proxyExceptionMessage = messageFrom(b);
|
|
123
|
+
if (proxyExceptionMessage !== undefined)
|
|
124
|
+
return { message: proxyExceptionMessage };
|
|
125
|
+
|
|
126
|
+
// Shape 2: FastAPI's `{"detail": ...}`.
|
|
127
|
+
if (typeof b.detail === "string") return { message: b.detail };
|
|
128
|
+
const detailMessage = messageFrom(b.detail);
|
|
129
|
+
if (detailMessage !== undefined) return { message: detailMessage };
|
|
130
|
+
|
|
131
|
+
return undefined;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
export const LitellmProtocol: Layer.Layer<API.Protocol> =
|
|
135
|
+
makeRestProtocol<Config>({
|
|
136
|
+
// Resolved on the CALLING fiber per request (the layer is memoized per
|
|
137
|
+
// process); the Credentials service holds an effect, so a key rotated
|
|
138
|
+
// between calls is picked up without rebuilding the layer.
|
|
139
|
+
credentials: Effect.gen(function* () {
|
|
140
|
+
const resolve = yield* Credentials;
|
|
141
|
+
return yield* resolve;
|
|
142
|
+
}),
|
|
143
|
+
baseUrl: (creds) => creds.apiBaseUrl,
|
|
144
|
+
headers: (creds) => ({
|
|
145
|
+
Authorization: `Bearer ${Redacted.value(creds.apiKey)}`,
|
|
146
|
+
Accept: "application/json",
|
|
147
|
+
}),
|
|
148
|
+
errorEnvelope,
|
|
149
|
+
unknownError: ({ code, message, body }) =>
|
|
150
|
+
new UnknownLitellmError({
|
|
151
|
+
code:
|
|
152
|
+
typeof code === "string"
|
|
153
|
+
? code
|
|
154
|
+
: code !== undefined
|
|
155
|
+
? String(code)
|
|
156
|
+
: undefined,
|
|
157
|
+
message,
|
|
158
|
+
body,
|
|
159
|
+
}),
|
|
160
|
+
});
|
package/src/retry.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LiteLLM retry surface — a veneer over `@distilled.cloud/core/retry`.
|
|
3
|
+
*
|
|
4
|
+
* The `Retry` service tag is threaded into every generated operation via
|
|
5
|
+
* `API.make({ retry: Retry })`, so a caller-installed policy applies to all
|
|
6
|
+
* LiteLLM calls below it and core's `makeDefault` is the fallback when none
|
|
7
|
+
* is provided.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import * as Litellm from "@distilled.cloud/litellm";
|
|
12
|
+
*
|
|
13
|
+
* myEffect.pipe(Litellm.Retry.transient);
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import * as Context from "effect/Context";
|
|
17
|
+
import * as Effect from "effect/Effect";
|
|
18
|
+
import * as Layer from "effect/Layer";
|
|
19
|
+
import * as Retries from "@distilled.cloud/core/retry";
|
|
20
|
+
|
|
21
|
+
export type Options = Retries.Options;
|
|
22
|
+
export type Factory = Retries.Factory;
|
|
23
|
+
export type Policy = Retries.Policy;
|
|
24
|
+
|
|
25
|
+
/** Context tag for configuring retry behavior of LiteLLM API calls. */
|
|
26
|
+
export class Retry extends Context.Service<Retry, Policy>()("LitellmRetry") {}
|
|
27
|
+
|
|
28
|
+
/** Provides a custom retry policy to every LiteLLM API call below it. */
|
|
29
|
+
export const policy: {
|
|
30
|
+
(
|
|
31
|
+
options: Options,
|
|
32
|
+
): <A, E, R>(
|
|
33
|
+
effect: Effect.Effect<A, E, R>,
|
|
34
|
+
) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
35
|
+
(
|
|
36
|
+
factory: Factory,
|
|
37
|
+
): <A, E, R>(
|
|
38
|
+
effect: Effect.Effect<A, E, R>,
|
|
39
|
+
) => Effect.Effect<A, E, Exclude<R, Retry>>;
|
|
40
|
+
} = (optionsOrFactory: Options | Factory) =>
|
|
41
|
+
Effect.provide(Layer.succeed(Retry, optionsOrFactory));
|
|
42
|
+
|
|
43
|
+
/** Disables all automatic retries. */
|
|
44
|
+
export const none: <A, E, R>(
|
|
45
|
+
effect: Effect.Effect<A, E, R>,
|
|
46
|
+
) => Effect.Effect<A, E, Exclude<R, Retry>> = Effect.provide(
|
|
47
|
+
Layer.succeed(Retry, { while: () => false }),
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The default retry policy (core's): transient/throttling/retryable errors,
|
|
52
|
+
* capped exponential backoff with jitter, server `retryAfter` hints honored
|
|
53
|
+
* with precedence.
|
|
54
|
+
*/
|
|
55
|
+
export const makeDefault: Factory = Retries.makeDefault;
|
|
56
|
+
|
|
57
|
+
export const jittered = Retries.jittered;
|
|
58
|
+
export const capped = Retries.capped;
|
|
59
|
+
|
|
60
|
+
/** Retry options that retry all throttling errors indefinitely. */
|
|
61
|
+
export const throttlingOptions: Options = Retries.throttlingOptions;
|
|
62
|
+
|
|
63
|
+
/** Retries all throttling errors indefinitely (honoring server hints). */
|
|
64
|
+
export const throttling: <A, E, R>(
|
|
65
|
+
effect: Effect.Effect<A, E, R>,
|
|
66
|
+
) => Effect.Effect<A, E, Exclude<R, Retry>> = policy(Retries.throttlingFactory);
|
|
67
|
+
|
|
68
|
+
/** Retry options that retry all transient errors indefinitely. */
|
|
69
|
+
export const transientOptions: Options = Retries.transientOptions;
|
|
70
|
+
|
|
71
|
+
/** Retries all transient errors indefinitely (honoring server hints). */
|
|
72
|
+
export const transient: <A, E, R>(
|
|
73
|
+
effect: Effect.Effect<A, E, R>,
|
|
74
|
+
) => Effect.Effect<A, E, Exclude<R, Retry>> = policy(Retries.transientFactory);
|