Copy disabled (too large)
Download .txt
Showing preview only (26,630K chars total). Download the full file to get everything.
Repository: Portkey-AI/gateway
Branch: main
Commit: 28ed85e42e11
Files: 724
Total size: 25.3 MB
Directory structure:
gitextract__7o1qj1m/
├── .dockerignore
├── .git-blame-ignore-revs
├── .gitattributes
├── .github/
│ ├── CODE_OF_CONDUCT.md
│ ├── CONTRIBUTING.cn.md
│ ├── CONTRIBUTING.md
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.yml
│ │ ├── config.yml
│ │ └── feature_request.yml
│ ├── README.cn.md
│ ├── README.jp.md
│ ├── SECURITY.md
│ ├── SUPPORT.md
│ ├── cn.CODE_OF_CONDUCT.md
│ ├── pull_request_template.md
│ └── workflows/
│ ├── check_code_formatting.yml
│ ├── docker_publish.yml
│ ├── link-checker.yml
│ ├── npm_publish.yml
│ ├── run_tests.yml
│ └── triage-label.yml
├── .gitignore
├── .husky/
│ ├── pre-commit
│ └── pre-push
├── .prettierignore
├── .prettierrc
├── .vscode/
│ ├── launch.json
│ └── tasks.json
├── CLAUDE.md
├── Dockerfile
├── LICENSE
├── README.md
├── conf.example.json
├── cookbook/
│ ├── README.md
│ ├── getting-started/
│ │ ├── automatic-retries-on-failures.md
│ │ ├── enable-cache.md
│ │ ├── fallback-from-openai-to-azure.ipynb
│ │ ├── fallback-from-stable-diffusion-to-dall-e.ipynb
│ │ ├── gentle-introduction-to-portkey-gateway.ipynb
│ │ ├── image-generation.ipynb
│ │ ├── resilient-loadbalancing-with-failure-mitigating-fallbacks.md
│ │ └── writing-your-first-gateway-config.md
│ ├── guardrails/
│ │ └── Langchain Chatbot with PII Guardrails.ipynb
│ ├── integrations/
│ │ ├── Instructor_with_Portkey.ipynb
│ │ ├── Mistral.ipynb
│ │ ├── Phidata_with_ Perplexity.ipynb
│ │ ├── Phidata_with_Portkey.ipynb
│ │ ├── ReAct Agents Portkey.ipynb
│ │ ├── Sutra_with_Portkey.ipynb
│ │ ├── Tool_Use_with_Portkey.ipynb
│ │ ├── anyscale.md
│ │ ├── deepinfra.ipynb
│ │ ├── groq.ipynb
│ │ ├── langchain.ipynb
│ │ ├── mistral.md
│ │ ├── mixtral-8x22b.ipynb
│ │ ├── ncompass.ipynb
│ │ ├── openai.ipynb
│ │ ├── segmind.ipynb
│ │ ├── vercel/
│ │ │ ├── app/
│ │ │ │ ├── api/
│ │ │ │ │ └── chat/
│ │ │ │ │ └── route.ts
│ │ │ │ ├── examples/
│ │ │ │ │ ├── basic-chatbot/
│ │ │ │ │ │ └── page.tsx
│ │ │ │ │ ├── generate-text/
│ │ │ │ │ │ ├── action.ts
│ │ │ │ │ │ ├── conditional-routing.ts
│ │ │ │ │ │ ├── fallback.ts
│ │ │ │ │ │ ├── guardrails.ts
│ │ │ │ │ │ ├── load-balance.ts
│ │ │ │ │ │ └── page.tsx
│ │ │ │ │ ├── generate-ui-streamui/
│ │ │ │ │ │ ├── action.tsx
│ │ │ │ │ │ ├── joke-component.tsx
│ │ │ │ │ │ ├── joke.ts
│ │ │ │ │ │ └── page.tsx
│ │ │ │ │ ├── layout.tsx
│ │ │ │ │ ├── stream-text/
│ │ │ │ │ │ ├── action.ts
│ │ │ │ │ │ └── page.tsx
│ │ │ │ │ └── tools/
│ │ │ │ │ └── basic/
│ │ │ │ │ ├── action.ts
│ │ │ │ │ └── page.tsx
│ │ │ │ ├── globals.css
│ │ │ │ ├── layout.tsx
│ │ │ │ └── page.tsx
│ │ │ ├── components/
│ │ │ │ ├── back-button.tsx
│ │ │ │ ├── link.tsx
│ │ │ │ └── ui/
│ │ │ │ ├── button.tsx
│ │ │ │ ├── card.tsx
│ │ │ │ ├── input.tsx
│ │ │ │ └── label.tsx
│ │ │ ├── components.json
│ │ │ ├── core/
│ │ │ │ ├── generate-text.ts
│ │ │ │ ├── stream-text.ts
│ │ │ │ └── tools.ts
│ │ │ ├── lib/
│ │ │ │ └── utils.ts
│ │ │ ├── next-env.d.ts
│ │ │ ├── next.config.mjs
│ │ │ ├── package.json
│ │ │ ├── postcss.config.js
│ │ │ ├── readme.md
│ │ │ ├── tailwind.config.ts
│ │ │ └── tsconfig.json
│ │ └── vercel-ai.md
│ ├── monitoring-agents/
│ │ ├── Autogen_with_Telemetry.ipynb
│ │ ├── ControlFlow_with_Telemetry.ipynb
│ │ ├── CrewAI_with_Telemetry.ipynb
│ │ └── Llama_Agents_with_Telemetry.ipynb
│ ├── providers/
│ │ ├── aibadgr.ipynb
│ │ ├── anthropic.ipynb
│ │ ├── deepinfra.ipynb
│ │ ├── groq.ipynb
│ │ ├── mistral.ipynb
│ │ ├── ncompass.ipynb
│ │ ├── nvidia.ipynb
│ │ ├── openai.ipynb
│ │ ├── segmind.ipynb
│ │ └── together.ipynb
│ └── use-cases/
│ ├── Claude_3_5_Sonnet_vs_GPT_4o_Portkey.ipynb
│ ├── Claude_3_5_Sonnet_with_Portkey.ipynb
│ ├── Contextual Embeddings Guide Anthropic, Cohere, Voyage.ipynb
│ ├── Creating_Artifacts_with_GPT_4o_.ipynb
│ ├── GPT-4o & Portkey/
│ │ ├── Audio Processing - GPT-4o & Portkey.ipynb
│ │ ├── GPT-4o vs Claude-3-Opus vs Gemini-1.5-Pro - Portkey.ipynb
│ │ ├── Image Processing - GPT-4o & Portkey.ipynb
│ │ ├── Intro_to_GPT4o_Portkey.ipynb
│ │ └── Video Processing - GPT-4o & Portkey.ipynb
│ ├── LMSYS Series/
│ │ ├── Comparision_of_Top_6_LMSYS_Vison_models_using_Portkey.ipynb
│ │ ├── README.md
│ │ └── comparing-top10-LMSYS-models-with-Portkey.ipynb
│ ├── Nemotron_GPT_Finetuning_Portkey.ipynb
│ ├── Testing_Top_Vision_Models.ipynb
│ ├── llama-3-on-groq.ipynb
│ ├── run-gateway-on-prompts-from-langchain-hub.md
│ ├── smart-fallback-with-model-optimized-prompts.md
│ ├── supabase-pgvector-and-portkey.md
│ └── use-openai-sdk-with-portkey-prompt-templates.md
├── deployment.yaml
├── docker-compose.yaml
├── docs/
│ ├── deploy-on-replit.md
│ └── installation-deployments.md
├── eslint.config.js
├── initializeSettings.ts
├── jest.config.js
├── package.json
├── patches/
│ ├── @types+async-retry+1.4.5.patch
│ └── async-retry+1.3.3.patch
├── plugins/
│ ├── Contributing.md
│ ├── README.md
│ ├── acuvity/
│ │ ├── helper.test.ts
│ │ ├── helper.ts
│ │ ├── manifest.json
│ │ ├── model.ts
│ │ ├── scan.test.ts
│ │ └── scan.ts
│ ├── aporia/
│ │ ├── aporia.test.ts
│ │ ├── manifest.json
│ │ └── validateProject.ts
│ ├── azure/
│ │ ├── azure.test.ts
│ │ ├── contentSafety.ts
│ │ ├── manifest.json
│ │ ├── pii.ts
│ │ ├── protectedMaterial.ts
│ │ ├── shieldPrompt.ts
│ │ ├── types.ts
│ │ └── utils.ts
│ ├── bedrock/
│ │ ├── bedrock.test.ts
│ │ ├── index.ts
│ │ ├── manifest.json
│ │ ├── type.ts
│ │ └── util.ts
│ ├── build.ts
│ ├── crowdstrike-aidr/
│ │ ├── aidr.test.ts
│ │ ├── guardChatCompletion.ts
│ │ ├── manifest.json
│ │ └── version.ts
│ ├── default/
│ │ ├── addPrefix.ts
│ │ ├── alllowercase.ts
│ │ ├── allowedRequestTypes.ts
│ │ ├── alluppercase.ts
│ │ ├── characterCount.ts
│ │ ├── contains.ts
│ │ ├── containsCode.ts
│ │ ├── default.test.ts
│ │ ├── endsWith.ts
│ │ ├── jsonKeys.ts
│ │ ├── jsonSchema.ts
│ │ ├── jwt.ts
│ │ ├── log.ts
│ │ ├── manifest.json
│ │ ├── modelRules.ts
│ │ ├── modelWhitelist.ts
│ │ ├── notNull.ts
│ │ ├── regexMatch.ts
│ │ ├── regexReplace.ts
│ │ ├── requiredMetadataKeys.ts
│ │ ├── sentenceCount.ts
│ │ ├── validUrls.ts
│ │ ├── webhook.ts
│ │ └── wordCount.ts
│ ├── exa/
│ │ ├── exa.test.ts
│ │ ├── manifest.json
│ │ └── online.ts
│ ├── f5-guardrails/
│ │ ├── manifest.json
│ │ ├── scan.test.ts
│ │ └── scan.ts
│ ├── index.ts
│ ├── javelin/
│ │ ├── guardrails.ts
│ │ ├── javelin.test.ts
│ │ └── manifest.json
│ ├── lasso/
│ │ ├── README.md
│ │ ├── classify.ts
│ │ ├── lasso.test.ts
│ │ └── manifest.json
│ ├── mistral/
│ │ ├── index.ts
│ │ ├── manifest.json
│ │ └── mistral.test.ts
│ ├── pangea/
│ │ ├── manifest.json
│ │ ├── pangea.test.ts
│ │ ├── pii.ts
│ │ ├── textGuard.ts
│ │ └── version.ts
│ ├── panw-prisma-airs/
│ │ ├── intercept.ts
│ │ ├── manifest.json
│ │ └── panw.airs.test.ts
│ ├── patronus/
│ │ ├── custom.ts
│ │ ├── globals.ts
│ │ ├── isConcise.ts
│ │ ├── isHelpful.ts
│ │ ├── isPolite.ts
│ │ ├── manifest.json
│ │ ├── noApologies.ts
│ │ ├── noGenderBias.ts
│ │ ├── noRacialBias.ts
│ │ ├── patronus.test.ts
│ │ ├── phi.ts
│ │ ├── pii.ts
│ │ ├── retrievalAnswerRelevance.ts
│ │ ├── retrievalHallucination.ts
│ │ └── toxicity.ts
│ ├── pillar/
│ │ ├── globals.ts
│ │ ├── manifest.json
│ │ ├── pillar.test.ts
│ │ ├── scanPrompt.ts
│ │ └── scanResponse.ts
│ ├── portkey/
│ │ ├── gibberish.ts
│ │ ├── globals.ts
│ │ ├── language.ts
│ │ ├── manifest.json
│ │ ├── moderateContent.ts
│ │ ├── pii.ts
│ │ └── portkey.test.ts
│ ├── promptfoo/
│ │ ├── globals.ts
│ │ ├── guard.ts
│ │ ├── harm.ts
│ │ ├── manifest.json
│ │ ├── pii.ts
│ │ ├── promptfoo.test.ts
│ │ └── types.ts
│ ├── promptsecurity/
│ │ ├── manifest.json
│ │ ├── promptsecurity.test.ts
│ │ ├── protectPrompt.ts
│ │ ├── protectResponse.ts
│ │ └── shared.ts
│ ├── qualifire/
│ │ ├── contentModeration.ts
│ │ ├── globals.ts
│ │ ├── grounding.ts
│ │ ├── hallucinations.ts
│ │ ├── manifest.json
│ │ ├── pii.ts
│ │ ├── policy.ts
│ │ ├── promptInjections.ts
│ │ ├── qualifire.test.ts
│ │ └── toolUseQuality.ts
│ ├── sydelabs/
│ │ ├── manifest.json
│ │ ├── sydeguard.ts
│ │ └── sydelabs.test.ts
│ ├── types.ts
│ ├── utils.test.ts
│ ├── utils.ts
│ └── walledai/
│ ├── manifest.json
│ ├── walledai.test.ts
│ └── walledprotect.ts
├── rollup.config.js
├── src/
│ ├── apm/
│ │ └── index.ts
│ ├── data/
│ │ ├── models.json
│ │ └── providers.json
│ ├── errors/
│ │ ├── GatewayError.ts
│ │ └── RouterError.ts
│ ├── globals.ts
│ ├── handlers/
│ │ ├── batchesHandler.ts
│ │ ├── chatCompletionsHandler.ts
│ │ ├── completionsHandler.ts
│ │ ├── createSpeechHandler.ts
│ │ ├── createTranscriptionHandler.ts
│ │ ├── createTranslationHandler.ts
│ │ ├── embeddingsHandler.ts
│ │ ├── filesHandler.ts
│ │ ├── finetuneHandler.ts
│ │ ├── handlerUtils.ts
│ │ ├── imageEditsHandler.ts
│ │ ├── imageGenerationsHandler.ts
│ │ ├── messagesCountTokensHandler.ts
│ │ ├── messagesHandler.ts
│ │ ├── modelResponsesHandler.ts
│ │ ├── modelsHandler.ts
│ │ ├── proxyHandler.ts
│ │ ├── realtimeHandler.ts
│ │ ├── realtimeHandlerNode.ts
│ │ ├── responseHandlers.ts
│ │ ├── retryHandler.ts
│ │ ├── services/
│ │ │ ├── cacheService.ts
│ │ │ ├── hooksService.ts
│ │ │ ├── logsService.ts
│ │ │ ├── preRequestValidatorService.ts
│ │ │ ├── providerContext.ts
│ │ │ ├── requestContext.ts
│ │ │ └── responseService.ts
│ │ ├── streamHandler.ts
│ │ ├── streamHandlerUtils.ts
│ │ └── websocketUtils.ts
│ ├── index.ts
│ ├── middlewares/
│ │ ├── cache/
│ │ │ └── index.ts
│ │ ├── hooks/
│ │ │ ├── globals.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── log/
│ │ │ └── index.ts
│ │ └── requestValidator/
│ │ ├── index.ts
│ │ └── schema/
│ │ └── config.ts
│ ├── providers/
│ │ ├── 302ai/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── ai21/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── embed.ts
│ │ │ └── index.ts
│ │ ├── aibadgr/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── anthropic/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── index.ts
│ │ │ ├── messages.ts
│ │ │ ├── types.ts
│ │ │ └── utils.ts
│ │ ├── anthropic-base/
│ │ │ ├── constants.ts
│ │ │ ├── messages.ts
│ │ │ ├── types.ts
│ │ │ └── utils/
│ │ │ └── streamGenerator.ts
│ │ ├── anyscale/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── embed.ts
│ │ │ └── index.ts
│ │ ├── azure-ai-inference/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── embed.ts
│ │ │ ├── getBatchOutput.ts
│ │ │ ├── index.ts
│ │ │ ├── messages.ts
│ │ │ └── utils.ts
│ │ ├── azure-openai/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── createBatch.ts
│ │ │ ├── createFinetune.ts
│ │ │ ├── createSpeech.ts
│ │ │ ├── createTranscription.ts
│ │ │ ├── createTranslation.ts
│ │ │ ├── embed.ts
│ │ │ ├── getBatchOutput.ts
│ │ │ ├── imageGenerate.ts
│ │ │ ├── index.ts
│ │ │ └── utils.ts
│ │ ├── bedrock/
│ │ │ ├── api.ts
│ │ │ ├── cancelBatch.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── constants.ts
│ │ │ ├── countTokens.ts
│ │ │ ├── createBatch.ts
│ │ │ ├── createFinetune.ts
│ │ │ ├── deleteFile.ts
│ │ │ ├── embed.ts
│ │ │ ├── getBatchOutput.ts
│ │ │ ├── imageGenerate.ts
│ │ │ ├── index.ts
│ │ │ ├── listBatches.ts
│ │ │ ├── listFinetunes.ts
│ │ │ ├── listfiles.ts
│ │ │ ├── messages.ts
│ │ │ ├── retrieveBatch.ts
│ │ │ ├── retrieveFile.ts
│ │ │ ├── retrieveFileContent.ts
│ │ │ ├── retrieveFinetune.ts
│ │ │ ├── types.ts
│ │ │ ├── uploadFile.ts
│ │ │ ├── uploadFileUtils.ts
│ │ │ ├── utils/
│ │ │ │ └── messagesUtils.ts
│ │ │ └── utils.ts
│ │ ├── bytez/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── cerebras/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── cohere/
│ │ │ ├── api.ts
│ │ │ ├── cancelBatch.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── createBatch.ts
│ │ │ ├── deleteFile.ts
│ │ │ ├── embed.ts
│ │ │ ├── getBatchOutput.ts
│ │ │ ├── getFiles.ts
│ │ │ ├── index.ts
│ │ │ ├── listBatches.ts
│ │ │ ├── retrieveBatch.ts
│ │ │ ├── types.ts
│ │ │ ├── uploadFile.ts
│ │ │ └── utils.ts
│ │ ├── cometapi/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── embed.ts
│ │ │ └── index.ts
│ │ ├── cortex/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── dashscope/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── deepbricks/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── imageGenerate.ts
│ │ │ └── index.ts
│ │ ├── deepinfra/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── deepseek/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── featherless-ai/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── fireworks-ai/
│ │ │ ├── api.ts
│ │ │ ├── cancelFinetune.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── createFinetune.ts
│ │ │ ├── embed.ts
│ │ │ ├── imageGenerate.ts
│ │ │ ├── index.ts
│ │ │ ├── listFiles.ts
│ │ │ ├── listFinetune.ts
│ │ │ ├── retrieveFile.ts
│ │ │ ├── types.ts
│ │ │ ├── uploadFile.ts
│ │ │ └── utils.ts
│ │ ├── google/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── embed.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── google-vertex-ai/
│ │ │ ├── api.ts
│ │ │ ├── cancelBatch.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── createBatch.ts
│ │ │ ├── createFinetune.ts
│ │ │ ├── embed.ts
│ │ │ ├── getBatchOutput.ts
│ │ │ ├── imageGenerate.ts
│ │ │ ├── index.ts
│ │ │ ├── listBatches.ts
│ │ │ ├── listFiles.ts
│ │ │ ├── listFinetunes.ts
│ │ │ ├── messages.ts
│ │ │ ├── messagesCountTokens.ts
│ │ │ ├── retrieveBatch.ts
│ │ │ ├── retrieveFile.ts
│ │ │ ├── retrieveFileContent.ts
│ │ │ ├── retrieveFinetune.ts
│ │ │ ├── transformGenerationConfig.ts
│ │ │ ├── types.ts
│ │ │ ├── uploadFile.ts
│ │ │ ├── utils.test.ts
│ │ │ └── utils.ts
│ │ ├── groq/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── huggingface/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── index.ts
│ │ │ ├── types.ts
│ │ │ └── utils.ts
│ │ ├── hyperbolic/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── imageGenerate.ts
│ │ │ └── index.ts
│ │ ├── index.ts
│ │ ├── inference-net/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── iointelligence/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── jina/
│ │ │ ├── api.ts
│ │ │ ├── embed.ts
│ │ │ └── index.ts
│ │ ├── kluster-ai/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── index.ts
│ │ │ └── uploadFile.ts
│ │ ├── krutrim/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── lambda/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── lemonfox-ai/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── createTranscription.ts
│ │ │ ├── imageGenerate.ts
│ │ │ └── index.ts
│ │ ├── lepton/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── createTranscription.ts
│ │ │ └── index.ts
│ │ ├── lingyi/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── matterai/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── meshy/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── milvus/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── mistral-ai/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── embed.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── modal/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── monsterapi/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── moonshot/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── ncompass/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── nebius/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── nextbit/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── nomic/
│ │ │ ├── api.ts
│ │ │ ├── embed.ts
│ │ │ └── index.ts
│ │ ├── novita-ai/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ └── index.ts
│ │ ├── nscale/
│ │ │ ├── api.ts
│ │ │ ├── imageGenerate.ts
│ │ │ └── index.ts
│ │ ├── ollama/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── embed.ts
│ │ │ └── index.ts
│ │ ├── open-ai-base/
│ │ │ ├── constants.ts
│ │ │ ├── createModelResponse.ts
│ │ │ ├── helpers.ts
│ │ │ └── index.ts
│ │ ├── openai/
│ │ │ ├── api.ts
│ │ │ ├── cancelBatch.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── createBatch.ts
│ │ │ ├── createFinetune.ts
│ │ │ ├── createSpeech.ts
│ │ │ ├── createTranscription.ts
│ │ │ ├── createTranslation.ts
│ │ │ ├── deleteFile.ts
│ │ │ ├── embed.ts
│ │ │ ├── getBatchOutput.ts
│ │ │ ├── imageGenerate.ts
│ │ │ ├── index.ts
│ │ │ ├── listBatches.ts
│ │ │ ├── listFiles.ts
│ │ │ ├── retrieveBatch.ts
│ │ │ ├── retrieveFileContent.ts
│ │ │ ├── uploadFile.ts
│ │ │ └── utils.ts
│ │ ├── openrouter/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── index.ts
│ │ │ └── utils.ts
│ │ ├── oracle/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── index.ts
│ │ │ ├── types/
│ │ │ │ ├── ChatDetails.ts
│ │ │ │ └── GenericChatResponse.ts
│ │ │ └── utils.ts
│ │ ├── ovhcloud/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── palm/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── embed.ts
│ │ │ └── index.ts
│ │ ├── perplexity-ai/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── predibase/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── qdrant/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── recraft-ai/
│ │ │ ├── api.ts
│ │ │ ├── imageGenerate.ts
│ │ │ ├── index.ts
│ │ │ └── utils.ts
│ │ ├── reka-ai/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── replicate/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── sagemaker/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── sambanova/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ └── index.ts
│ │ ├── segmind/
│ │ │ ├── api.ts
│ │ │ ├── imageGenerate.ts
│ │ │ └── index.ts
│ │ ├── siliconflow/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── embed.ts
│ │ │ ├── imageGenerate.ts
│ │ │ └── index.ts
│ │ ├── stability-ai/
│ │ │ ├── api.ts
│ │ │ ├── constants.ts
│ │ │ ├── imageGenerate.ts
│ │ │ ├── imageGenerateV2.ts
│ │ │ ├── index.ts
│ │ │ └── utils.ts
│ │ ├── together-ai/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── embed.ts
│ │ │ ├── index.ts
│ │ │ └── types.ts
│ │ ├── tripo3d/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── triton/
│ │ │ ├── api.ts
│ │ │ ├── complete.ts
│ │ │ └── index.ts
│ │ ├── types.ts
│ │ ├── upstage/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── utils/
│ │ │ └── finishReasonMap.ts
│ │ ├── utils.ts
│ │ ├── voyage/
│ │ │ ├── api.ts
│ │ │ ├── embed.ts
│ │ │ └── index.ts
│ │ ├── workers-ai/
│ │ │ ├── api.ts
│ │ │ ├── chatComplete.ts
│ │ │ ├── complete.ts
│ │ │ ├── embed.ts
│ │ │ ├── imageGenerate.ts
│ │ │ ├── index.ts
│ │ │ └── utils.ts
│ │ ├── x-ai/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ ├── z-ai/
│ │ │ ├── api.ts
│ │ │ └── index.ts
│ │ └── zhipu/
│ │ ├── api.ts
│ │ ├── chatComplete.ts
│ │ ├── embed.ts
│ │ └── index.ts
│ ├── public/
│ │ └── index.html
│ ├── services/
│ │ ├── conditionalRouter.ts
│ │ ├── realtimeLlmEventParser.ts
│ │ └── transformToProviderRequest.ts
│ ├── shared/
│ │ ├── services/
│ │ │ └── cache/
│ │ │ ├── backends/
│ │ │ │ ├── cloudflareKV.ts
│ │ │ │ ├── file.ts
│ │ │ │ ├── memory.ts
│ │ │ │ └── redis.ts
│ │ │ ├── index.ts
│ │ │ ├── types.ts
│ │ │ └── utils/
│ │ │ └── rateLimiter.ts
│ │ └── utils/
│ │ └── logger.ts
│ ├── start-server.ts
│ ├── tests/
│ │ ├── common.test.ts
│ │ ├── resources/
│ │ │ ├── constants.ts
│ │ │ ├── requestTemplates.ts
│ │ │ ├── testVariables.ts
│ │ │ └── utils.ts
│ │ └── routeSpecificTestFunctions.ts/
│ │ └── chatCompletion.ts
│ ├── types/
│ │ ├── MessagesRequest.ts
│ │ ├── MessagesStreamResponse.ts
│ │ ├── embedRequestBody.ts
│ │ ├── inputList.ts
│ │ ├── messagesResponse.ts
│ │ ├── modelResponses.ts
│ │ ├── requestBody.ts
│ │ ├── responseBody.ts
│ │ └── shared.ts
│ ├── utils/
│ │ ├── CryptoUtils.ts
│ │ ├── env.ts
│ │ └── misc.ts
│ └── utils.ts
├── start-test.js
├── tests/
│ ├── integration/
│ │ └── src/
│ │ └── handlers/
│ │ ├── .creds.example.json
│ │ ├── requestBuilder.ts
│ │ ├── test.txt
│ │ └── tryPost.test.ts
│ └── unit/
│ └── src/
│ └── handlers/
│ └── services/
│ ├── benchmark.ts
│ ├── cacheService.test.ts
│ ├── hooksService.test.ts
│ ├── logsService.test.ts
│ ├── preRequestValidatorService.test.ts
│ ├── providerContext.test.ts
│ ├── requestContext.test.ts
│ └── responseService.test.ts
├── tsconfig.json
└── wrangler.toml
================================================
FILE CONTENTS
================================================
================================================
FILE: .dockerignore
================================================
.toml
docs
================================================
FILE: .git-blame-ignore-revs
================================================
# Initial prettier formatting
77f32e57b14bd3585169b7bc884ff9ddf38e8ea1
================================================
FILE: .gitattributes
================================================
# Declare files that will always have LF line endings on checkout.
*.sh text eol=lf
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
*.gz binary
*.zip binary
*.7z binary
*.ttf binary
*.eot binary
*.woff binary
*.woff2 binary
# Ignore cookbook folder for language statistics
cookbook/** linguist-vendored
docs/** linguist-vendored
# Treat package-lock.json and yarn.lock as binary to avoid merge conflicts
package-lock.json binary
yarn.lock binary
# Treat .env files as binary to avoid accidental commits of sensitive information
*.env binary
================================================
FILE: .github/CODE_OF_CONDUCT.md
================================================
<p align="right">
<strong>English</strong>|<a href="https://github.com/Portkey-AI/gateway/blob/main/.github/cn.CODE_OF_CONDUCT.md">中文</a>
</p>
# Contributor Covenant Code of Conduct
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
support@portkey.ai.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series
of actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
the community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
================================================
FILE: .github/CONTRIBUTING.cn.md
================================================
## 🎉 欢迎
你好,感谢你考虑为Portkey的AI网关做出贡献!无论你是在报告一个bug,建议一个功能,改进文档,还是编写代码,你的贡献对我们来说都是非常宝贵的。
## 🚀 快速开始
1. 在Github上Fork仓库。
2. 将你fork的仓库克隆到你的机器上。
```sh
$ git clone https://github.com/YOUR_USERNAME/gateway.git
```
## 🖋 贡献类型
1. 新的集成:为其他LLM供应商或总体供应商创建集成。
2. Bug修复
3. 增强
4. 文档
5. **Hacktoberfest** 提交!
## 🗓️ Hacktoberfest
在 [Hacktoberfest 月](https://hacktoberfest.com/)期间,从10月1日到31日,您被接受的 PR 将计入您的 Hacktoberfest 参与度!🚀
✅ 要获得接受,您的 PR 必须被合并、批准或贴上 `hacktoberfest-accepted` 标签。
🧐 记得遵守 [质量标准](https://hacktoberfest.digitalocean.com/resources/qualitystandards)以避免您的 PR 被标记为 `垃圾邮件` 或 `无效`。
## 🔄 提交 PR
1. 完成您的更改后,通过运行以下命令来格式化和 Lint 您的代码:
```sh
make format; make lint
```
2. 在提交 PR 时,请在标题前添加以下任何一个:
* `provider:` 添加新的 LLM 提供商。
* `integration:` 新的集成。
* `docs:` 新的指南、文档添加等。
* `improvement:` 改进或增强。
* `bug:` 修复错误。
* `hacktoberfest:` Hacktoberfest 贡献。
## 🤔 寻求帮助
遇到问题或有疑问?请毫不犹豫地在我们的 [Discord 社区](https://discord.com/invite/DD7vgKK299) 分享您的疑问或问题 - 这是获得支持和与其他贡献者联系的最快方式。
## 🚧 发布流程
我们尽快进行发布,以确保新功能和修复能快速地到达用户手中。我们遵循无缝的 CI/CD 流水线,以确保代码从开发到生产的平稳过渡。
## 🎊 您的 PR 被合并了!
所有成功的 PR 都会在我们的 [Discord](https://discord.com/invite/DD7vgKK299) 上庆祝,并在发布说明中提及,重大贡献将在我们的 [Twitter](https://twitter.com/PortkeyAI) 上突出显示。请继续关注,未来我们将为贡献者提供更多奖金和礼品!
================================================
FILE: .github/CONTRIBUTING.md
================================================
## 🎉 Welcome
Hello and thank you for considering contributing to Portkey's AI Gateway! Whether you're reporting a bug, suggesting a feature, improving documentation, or writing code, your contributions are invaluable to us.
## 🚀 Quick Start
1. Fork the repository on Github.
2. Clone your forked repository to your machine.
```sh
$ git clone https://github.com/YOUR_USERNAME/gateway.git
```
## 🖋 Types of Contributions
1. New integrations: Creating integrations for other LLM providers or vendors in general.
2. Bug fixes
3. Enhancements
4. Documentation
5. **Hacktoberfest** submissions!
## 🗓️ Hacktoberfest
During the [Hacktoberfest month](https://hacktoberfest.com/), running from October 1st to 31st, your accepted PR will count towards your Hacktoberfest participation! 🚀
✅ To gain acceptance, your PR must be merged, approved, or tagged with the `hacktoberfest-accepted` label.
🧐 Remember to adhere to the [quality standards](https://hacktoberfest.digitalocean.com/resources/qualitystandards) to avoid your PR being marked as `spam` or `invalid`.
## 🔄 Raising PRs
1. Once you are done with your changes, format and Lint your code by running:
```sh
make format; make lint
```
2. While raising your PRs, please prepend any of the following to your title:
* `provider:` for adding new LLM providers.
* `integration:` for new integrations.
* `docs`: for new cookbooks, doc additions, etc.
* `improvement:` for improvements or enhancements.
* `bug:` for bug fixes.
* `hacktoberfest:` for Hacktoberfest contributions
## 🤔 Getting Help
Facing issues or have questions? Don't hesitate to share your doubts or questions on our [Discord Community](https://discord.com/invite/DD7vgKK299) - this is the quickest way to get support and connect with other contributors.
## 🚧 Release Process
Releases are made as soon as possible to ensure that new features and fixes reach our users quickly. We follow a seamless CI/CD pipeline to ensure the smooth transition of code from development to production.
## 🎊 Your PR is Merged!
All successful PRs are celebrated on our [Discord](https://discord.com/invite/DD7vgKK299) and are mentioned in the release notes, and significant contributions are highlighted on our [Twitter](https://twitter.com/PortkeyAI). Stay tuned for more bounties and goodies for contributors in the near future!
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.yml
================================================
name: Bug Report
description: Report any issue with the project
labels: ["bug"]
body:
- type: textarea
id: what-happened
attributes:
label: What Happened?
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: What Should Have Happened?
validations:
required: false
- type: textarea
id: code-snippet
attributes:
label: Relevant Code Snippet
validations:
required: false
- type: input
id: contact
attributes:
label: Your Twitter/LinkedIn
description: When the bug get fixed, we'd like to thank you publicly for reporting it.
validations:
required: false
================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: true
contact_links:
- name: Discord for Support & Discussions
url: https://discord.com/invite/DD7vgKK299
about: Hang out with the community of LLM practitioners and resolve your issues fast
- name: Get on a Call
url: https://calendly.com/rohit-portkey/noam
about: Get a tailored demo for your use cases
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.yml
================================================
name: Feature Request
description: Suggest a new provider to integrate, new features, or something more
title: "[Feature] "
labels: ["enhancement"]
body:
- type: textarea
id: feature
attributes:
label: What Would You Like to See with the Gateway?
validations:
required: true
- type: textarea
id: context
attributes:
label: Context for your Request
description: Why you want this feature and how it beneits you.
validations:
required: false
- type: input
id: contact
attributes:
label: Your Twitter/LinkedIn
description: If we work on this request, we'd like to thank you publicly for suggesting it.
validations:
required: false
================================================
FILE: .github/README.cn.md
================================================
<div align="center">
<img src="/docs/images/gateway-border.png" width=350>
<p align="right">
<a href="../README.md">English</a> | <strong>中文</strong> | <a href="./README.jp.md">日本語</a>
</p>
# AI Gateway
### 通过一个快速友好的API链接超过100个大型语言模型。
[](./LICENSE)
[](https://portkey.ai/community)
[](https://twitter.com/portkeyai)
[](https://www.npmjs.com/package/@portkey-ai/gateway)
<!--  -->
</div>
<br><br>
[Portkey的AI网关](https://portkey.ai/features/ai-gateway) 是您的应用程序与托管的大型语言模型(LLMs)之间的接口。它通过统一的API简化了对OpenAI、Anthropic、Mistral、LLama2、Anyscale、Google Gemini等的API请求。
✅ 极速响应(快9.9倍),占用空间极小(安装后约45kb)<br>✅ 跨多个模型、提供商和密钥进行**负载均衡**<br>✅ 通过**备用方案**确保应用程序的稳定性<br>✅ 默认提供具有指数级备用方案的**自动重试**<br>✅ 根据需要插入中间件<br>✅ 经过超过**1000亿令牌**的实战测试<br> <br>
## 入门指南
### 安装
如果您熟悉Node.js和`npx`,您可以在本地运行您的私有AI网关。
```
npx @portkey-ai/gateway
```
<sup>
[ 其它部署选项 ]
<a href="https://portkey.wiki/gh-18"><img height="12" width="12" src="https://cfassets.portkey.ai/logo/dew-color.svg" /> Portkey Cloud 官方部署(推荐)</a>
<a href="../docs/installation-deployments.md#docker"><img height="12" width="12" src="https://cdn.simpleicons.org/docker/3776AB" /> Docker</a>
<a href="../docs/installation-deployments.md#nodejs-server"><img height="12" width="12" src="https://cdn.simpleicons.org/node.js/3776AB" /> Node.js</a>
<a href="../docs/installation-deployments.md#cloudflare-workers"><img height="12" width="12" src="https://cdn.simpleicons.org/cloudflare/3776AB" /> Cloudflare</a>
<a href="../docs/installation-deployments.md#replit"><img height="12" width="12" src="https://cdn.simpleicons.org/replit/3776AB" /> Replit</a>
<a href="../docs/installation-deployments.md"> 其它...</a>
</sup>
> 您的AI网关现在运行在 [http://localhost:8787](http://localhost:8787/) 🚀 <br>
### 使用方法
让我们尝试通过AI网关向OpenAI发起一个**聊天**请求:
```
bashCopy codecurl '127.0.0.1:8787/v1/chat/completions' \
-H 'x-portkey-provider: openai' \
-H "Authorization: Bearer $OPENAI_KEY" \
-H 'Content-Type: application/json' \
-d '{"messages": [{"role": "user","content": "Say this is test."}], "max_tokens": 20, "model": "gpt-4"}'
```
[支持的SDK完整列表](#supported-sdks)
<br>
## 支持的AI厂商
|| AI厂商 | 支持 | 流式 | 支持的端点 |
|---|---|---|---|--|
| <img src="docs/images/openai.png" width=25 />| OpenAI | ✅ |✅ | `/completions`, `/chat/completions`,`/embeddings`, `/assistants`, `/threads`, `/runs` |
| <img src="docs/images/azure.png" width=25>| Azure OpenAI | ✅ |✅ | `/completions`, `/chat/completions`,`/embeddings` |
| <img src="docs/images/anyscale.png" width=25>| Anyscale | ✅ | ✅ | `/chat/completions` |
| <img src="https://upload.wikimedia.org/wikipedia/commons/2/2d/Google-favicon-2015.png" width=25>| Google Gemini & Palm | ✅ |✅ | `/generateMessage`, `/generateText`, `/embedText` |
| <img src="docs/images/anthropic.png" width=25>| Anthropic | ✅ |✅ | `/messages`, `/complete` |
| <img src="docs/images/cohere.png" width=25>| Cohere | ✅ |✅ | `/generate`, `/embed`, `/rerank` |
| <img src="https://assets-global.website-files.com/64f6f2c0e3f4c5a91c1e823a/654693d569494912cfc0c0d4_favicon.svg" width=25>| Together AI | ✅ |✅ | `/chat/completions`, `/completions`, `/inference` |
| <img src="https://www.perplexity.ai/favicon.svg" width=25>| Perplexity | ✅ |✅ | `/chat/completions` |
| <img src="https://docs.mistral.ai/img/favicon.ico" width=25>| Mistral | ✅ |✅ | `/chat/completions`, `/embeddings` |
> [在这里查看支持的100多个模型的完整列表](https://portkey.ai/docs/welcome/what-is-portkey#ai-providers-supported)
<br />
## 特点
<table>
<tr>
<td>
<h4><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/universal-api">统一API签名</a></h4>
使用OpenAI的API签名连接100多个LLM。AI网关处理请求、响应和错误转换,因此您无需对代码进行任何更改。您可以使用OpenAI SDK本身连接到任何支持的LLM。
<br><br>
<img src="docs/images/openai.png" height=40 /> <img src="docs/images/azure.png" height=40 />
<img src="docs/images/anyscale.png" height=40 />
<img src="https://upload.wikimedia.org/wikipedia/commons/2/2d/Google-favicon-2015.png" height=40 /> <br><br>
<img src="docs/images/anthropic.png" height=40 />
<img src="docs/images/cohere.png" height=40 />
<img src="https://assets-global.website-files.com/64f6f2c0e3f4c5a91c1e823a/654693d569494912cfc0c0d4_favicon.svg" height=40 /> <br><br>
<img src="https://www.perplexity.ai/favicon.svg" height=40 />
<img src="https://docs.mistral.ai/img/favicon.ico" height=40 />
<img src="https://1000logos.net/wp-content/uploads/2021/10/logo-Meta.png" height=40 />
<br><br>
</td>
<td>
<h4><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/fallbacks">备用方案</a></h4>
不要让失败阻止您。备用功能允许您按优先顺序指定语言模型API(LLMs)列表。如果主LLM无法响应或遇到错误,Portkey将自动备用到列表中的下一个LLM,确保您的应用程序的稳定性和可靠性。
<br><br>
<img src="https://framerusercontent.com/images/gmlOW8yeKP2pGuIsObM6gKLzeMI.png" height=200 />
</td>
</tr>
</table>
<table>
<tr>
<td>
<h4><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/automatic-retries">自动重试</a></h4>
临时问题不应该意味着手动重新运行。AI网关可以自动重试失败的请求多达5次。我们采用指数退避策略,间隔重试尝试以防止网络过载。
<br><br>
<img src="https://github.com/roh26it/Rubeus/assets/971978/8a6e653c-94b2-4ba7-95c7-93544ee476b1" height=200 />
</td>
<td>
<h4><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/load-balancing">负载均衡</a></h4>
根据自定义权重在多个API密钥或提供商之间有效分配负载。这确保了您的生成式AI应用程序的高可用性和最佳性能,防止任何单一LLM成为性能瓶颈。
<br><br>
<img src="https://framerusercontent.com/images/6EWuq3FWhqrPe3kKLqVspevi4.png" height=200 />
</td>
</tr>
</table>
<br>
## 配置 AI 网关
AI 网关支持[配置](https://portkey.ai/docs/api-reference/config-object),以实现如**后备(fallbacks)**、**负载均衡(load balancing)**、**重试(retries)**等多样化的路由策略。
<br><br>
您可以在通过 `x-portkey-config` 头部进行 OpenAI 调用时使用这些配置
```js
// 使用 OpenAI JS SDK
const client = new OpenAI({
baseURL: "http://127.0.0.1:8787", // 网关 URL
defaultHeaders: {
'x-portkey-config': {.. 你的配置在这里 ..},
}
});
```
<br>
<details><summary>这里有一个示例配置,在回退到 Gemini Pro 之前会重试 OpenAI 请求 5 次</summary>
```js
{
"retry": { "count": 5 },
"strategy": { "mode": "fallback" },
"targets": [{
"provider": "openai",
"api_key": "sk-***"
},{
"provider": "google",
"api_key": "gt5***",
"override_params": {"model": "gemini-pro"}
}]
}
```
</details> <details> <summary>此配置将使得在 2 个 OpenAI 密钥之间实现等量的负载均衡</summary>
```js
{
"strategy": { "mode": "loadbalance" },
"targets": [{
"provider": "openai",
"api_key": "sk-***",
"weight": "0.5"
},{
"provider": "openai",
"api_key": "sk-***",
"weight": "0.5"
}
]
}
```
</details>
了解更多关于配置对象。
<br>
## 支持的SDKs
| 语言 | 支持的SDKs |
|---|---|
| Node.js / JS / TS | [Portkey SDK](https://www.npmjs.com/package/portkey-ai) <br> [OpenAI SDK](https://www.npmjs.com/package/openai) <br> [LangchainJS](https://www.npmjs.com/package/langchain) <br> [LlamaIndex.TS](https://www.npmjs.com/package/llamaindex) |
| Python | [Portkey SDK](https://pypi.org/project/portkey-ai/) <br> [OpenAI SDK](https://pypi.org/project/openai/) <br> [Langchain](https://pypi.org/project/langchain/) <br> [LlamaIndex](https://pypi.org/project/llama-index/) |
| Go | [go-openai](https://github.com/sashabaranov/go-openai) |
| Java | [openai-java](https://github.com/TheoKanning/openai-java) |
| Rust | [async-openai](https://docs.rs/async-openai/latest/async_openai/) |
| Ruby | [ruby-openai](https://github.com/alexrudall/ruby-openai) |
<br>
## 部署 AI 网关
[查看文档](docs/installation-deployments.md)了解如何在本地安装 AI 网关或者在流行的平台上部署它。
<br>
## 路线图
1. 支持更多的提供商。如果缺少某个提供商或 LLM 平台,请[提出功能请求](https://github.com/Portkey-AI/gateway/issues)。
2. 增强的负载均衡功能,以优化不同模型和提供商之间的资源使用。
3. 更加健壮的后备和重试策略,以进一步提高请求的可靠性。
4. 增加统一 API 签名的可定制性,以满足更多样化的使用案例。
[💬 在这里参与路线图讨论。](https://github.com/Portkey-AI/gateway/projects/)
<br>
## 贡献
最简单的贡献方式是选择任何带有 `good first issue` 标签的问题 💪。在[这里](./CONTRIBUTING.md)阅读贡献指南。
发现 Bug?[在这里提交](https://github.com/Portkey-AI/gateway/issues) | 有功能请求?[在这里提交](https://github.com/Portkey-AI/gateway/issues)
<br>
## 社区
加入我们不断增长的全球社区,寻求帮助,分享想法,讨论 AI。
- 查看我们的官方[博客](https://portkey.ai/blog)
- 在 [Discord](https://portkey.ai/community) 上与我们实时交流
- 在 [Twitter](https://twitter.com/PortkeyAI) 上关注我们
- 在 [LinkedIn](https://www.linkedin.com/company/portkey-ai/) 上与我们建立联系
- 阅读日文版文档 [日本語](./README.jp.md)
<!-- - 在 [YouTube](https://www.youtube.com/channel/UCZph50gLNXAh1DpmeX8sBdw) 上访问我们 --> <!-- - 加入我们的 [Dev 社区](https://dev.to/portkeyai) --> <!-- - 在 [Stack Overflow](https://stackoverflow.com/questions/tagged/portkey) 上查看标记为 #portkey 的问题 -->

================================================
FILE: .github/README.jp.md
================================================
<div align="center">
<p align="right">
<a href="../README.md">English</a> | <a href="./README.cn.md">中文</a> | <strong>日本語</strong>
</p>
# AIゲートウェイ
#### 1つの高速でフレンドリーなAPIで200以上のLLMに確実にルーティング
<img src="docs/images/demo.gif" width="650" alt="Gateway Demo"><br>
[](./LICENSE)
[](https://portkey.ai/community)
[](https://twitter.com/portkeyai)
[](https://www.npmjs.com/package/@portkey-ai/gateway)
[](https://status.portkey.ai/?utm_source=status_badge)
</div>
[AIゲートウェイ](https://portkey.ai/features/ai-gateway)は、250以上の言語、ビジョン、オーディオ、画像モデルへのリクエストを統一されたAPIで簡素化します。キャッシング、フォールバック、リトライ、タイムアウト、ロードバランシングをサポートし、最小の遅延でエッジデプロイが可能なプロダクション対応のゲートウェイです。
✅ **超高速**(9.9倍速)で**小さなフットプリント**(ビルド後約100kb)<br>
✅ 複数のモデル、プロバイダー、キー間で**ロードバランシング**<br>
✅ **フォールバック**でアプリの信頼性を確保<br>
✅ デフォルトで**自動リトライ**(指数関数的フォールバック)<br>
✅ **リクエストタイムアウト**の設定が可能<br>
✅ **マルチモーダル**でビジョン、TTS、STT、画像生成モデルをサポート<br>
✅ 必要に応じてミドルウェアを**プラグイン**<br>
✅ **480Bトークン**以上の実績<br>
✅ **エンタープライズ対応**でセキュリティ、スケール、カスタムデプロイメントをサポート<br><br>
> [!TIP]
> ⭐️ **このリポジトリにスターを付ける**ことで、新しいプロバイダー統合や機能のGitHubリリース通知を受け取ることができます。

<details>
<summary><kbd>スター履歴</kbd></summary>
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=portkey-ai%2Fgateway&theme=dark&type=Date">
<img width="100%" src="https://api.star-history.com/svg?repos=portkey-ai%2Fgateway&type=Date">
</picture>
</details>
<br>
## セットアップとインストール
AIゲートウェイを使用するには、**ホストされたAPI**を使用するか、**オープンソース**または**エンタープライズバージョン**を自分の環境にセルフホストします。
<br>
### 👉 portkey.aiでホストされたゲートウェイ(最速)
ホストされたAPIは、ジェネレーティブAIアプリケーションのためのAIゲートウェイをセットアップする最速の方法です。私たちは**毎日数十億のトークン**を処理しており、Postman、Haptik、Turing、MultiOn、SiteGPTなどの企業でプロダクションで使用されています。
<a href="https://app.portkey.ai/signup"><img src="https://portkey.ai/blog/content/images/2024/08/Get-API-Key--3-.png" height=50 alt="Get API Key" /></a><br>
<br>
### 👉 オープンソースバージョンのセルフホスト([MITライセンス](https://github.com/Portkey-AI/gateway?tab=MIT-1-ov-file#readme))
ローカルでAIゲートウェイを実行するには、ターミナルで以下のコマンドを実行します。(npxがインストールされている必要があります)または、[Cloudflare](https://github.com/Portkey-AI/gateway/blob/main/docs/installation-deployments.md#cloudflare-workers)、[Docker](https://github.com/Portkey-AI/gateway/blob/main/docs/installation-deployments.md#docker)、[Node.js](https://github.com/Portkey-AI/gateway/blob/main/docs/installation-deployments.md#nodejs-server)などのデプロイメントガイドを参照してください。
```bash
npx @portkey-ai/gateway
```
<sup>あなたのAIゲートウェイはhttp://localhost:8787で実行されています 🚀</sup>
<br>
### 👉 エンタープライズバージョンのセルフホスト
AIゲートウェイのエンタープライズバージョンは、**組織管理**、**ガバナンス**、**セキュリティ**などのエンタープライズ対応機能を提供します。オープンソース、ホスト、エンタープライズバージョンの比較は[こちら](https://docs.portkey.ai/docs/product/product-feature-comparison)をご覧ください。
エンタープライズデプロイメントアーキテクチャ、サポートされているプラットフォームについては、[**エンタープライズプライベートクラウドデプロイメント**](https://docs.portkey.ai/docs/product/enterprise-offering/private-cloud-deployments)をご覧ください。
<a href="https://portkey.sh/demo-22"><img src="https://portkey.ai/blog/content/images/2024/08/Get-API-Key--5-.png" height=50 alt="Book an enterprise AI gateway demo" /></a><br>
<br>
## AIゲートウェイを通じたリクエストの作成
### <img src="docs/images/openai.png" height=15 /> OpenAI API & SDKと互換性あり
AIゲートウェイはOpenAI API & SDKと互換性があり、200以上のLLMに信頼性のある呼び出しを拡張します。ゲートウェイを通じてOpenAIを使用するには、**クライアントを更新**してゲートウェイのURLとヘッダーを含め、通常通りリクエストを行います。AIゲートウェイは、OpenAI形式で書かれたリクエストを指定されたプロバイダーが期待するシグネチャに変換できます。[例を表示](https://docs.portkey.ai/docs/guides/getting-started/getting-started-with-ai-gateway)
<br><br>
### <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/c/c3/Python-logo-notext.svg/1869px-Python-logo-notext.svg.png" height=15 /> Python SDKの使用 <a href="https://colab.research.google.com/drive/1hLvoq_VdGlJ_92sPPiwTznSra5Py0FuW?usp=sharing"><img src="https://colab.research.google.com/assets/colab-badge.svg"></a>
[Portkey Python SDK](https://github.com/Portkey-AI/portkey-python-sdk)は、OpenAI Python SDKのラッパーであり、他のすべてのプロバイダーに対する追加パラメータのサポートを提供します。**Pythonで構築している場合、これはゲートウェイに接続するための推奨ライブラリです**。
```bash
pip install -qU portkey-ai
```
<br>
### <img src="https://cdn-icons-png.flaticon.com/512/5968/5968322.png" height=15 /> Node.JS SDKの使用
[Portkey JS/TS SDK](https://www.npmjs.com/package/portkey-ai)は、OpenAI JS SDKのラッパーであり、他のすべてのプロバイダーに対する追加パラメータのサポートを提供します。**JSまたはTSで構築している場合、これはゲートウェイに接続するための推奨ライブラリです**。
```bash
npm install --save portkey-ai
```
<br>
### <img src="https://www.svgrepo.com/show/305922/curl.svg" height=15 /> REST APIの使用
AIゲートウェイは、すべての他のプロバイダーとモデルに対する追加パラメータのサポートを備えたOpenAI互換エンドポイントをサポートします。[APIリファレンスを表示](https://docs.portkey.ai/docs/api-reference/introduction)。
<br><br>
### その他の統合
| 言語 | サポートされているSDK |
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| JS / TS | [LangchainJS](https://www.npmjs.com/package/langchain) <br> [LlamaIndex.TS](https://www.npmjs.com/package/llamaindex) |
| Python | <br> [Langchain](https://portkey.ai/docs/welcome/integration-guides/langchain-python) <br> [LlamaIndex](https://portkey.ai/docs/welcome/integration-guides/llama-index-python) |
| Go | [go-openai](https://github.com/sashabaranov/go-openai) |
| Java | [openai-java](https://github.com/TheoKanning/openai-java) |
| Rust | [async-openai](https://docs.rs/async-openai/latest/async_openai/) |
| Ruby | [ruby-openai](https://github.com/alexrudall/ruby-openai) |
<br>
## ゲートウェイクックブック
### トレンドのクックブック
- [Nvidia NIM](/cookbook/providers/nvidia.ipynb)のモデルをAIゲートウェイで使用する
- [CrewAIエージェント](/cookbook/monitoring-agents/CrewAI_with_Telemetry.ipynb)をPortkeyで監視する
- AIゲートウェイで[トップ10のLMSYSモデルを比較する](./use-cases/LMSYS%20Series/comparing-top10-LMSYS-models-with-Portkey.ipynb)
### 最新のクックブック
* [Nemotronを使用して合成データセットを作成する](/cookbook/use-cases/Nemotron_GPT_Finetuning_Portkey.ipynb)
* [PortkeyゲートウェイをVercelのAI SDKと使用する](/cookbook/integrations/vercel-ai.md)
* [PortkeyでLlamaエージェントを監視する](/cookbook/monitoring-agents/Llama_Agents_with_Telemetry.ipynb)
### [その他の例](https://github.com/Portkey-AI/gateway/tree/main/cookbook)
## サポートされているプロバイダー
[25以上のプロバイダー](https://portkey.ai/docs/welcome/integration-guides)と[6以上のフレームワーク](https://portkey.ai/docs/welcome/integration-guides)とのゲートウェイ統合を探索してください。
| | プロバイダー | サポート | ストリーム |
| -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | ------- | ------ |
| <img src="docs/images/openai.png" width=35 /> | [OpenAI](https://portkey.ai/docs/welcome/integration-guides/openai) | ✅ | ✅ |
| <img src="docs/images/azure.png" width=35> | [Azure OpenAI](https://portkey.ai/docs/welcome/integration-guides/azure-openai) | ✅ | ✅ |
| <img src="docs/images/anyscale.png" width=35> | [Anyscale](https://portkey.ai/docs/welcome/integration-guides/anyscale-llama2-mistral-zephyr) | ✅ | ✅ |
| <img src="https://upload.wikimedia.org/wikipedia/commons/2/2d/Google-favicon-2015.png" width=35> | [Google Gemini & Palm](https://portkey.ai/docs/welcome/integration-guides/gemini) | ✅ | ✅ |
| <img src="docs/images/anthropic.png" width=35> | [Anthropic](https://portkey.ai/docs/welcome/integration-guides/anthropic) | ✅ | ✅ |
| <img src="docs/images/cohere.png" width=35> | [Cohere](https://portkey.ai/docs/welcome/integration-guides/cohere) | ✅ | ✅ |
| <img src="https://assets-global.website-files.com/64f6f2c0e3f4c5a91c1e823a/654693d569494912cfc0c0d4_favicon.svg" width=35> | [Together AI](https://portkey.ai/docs/welcome/integration-guides/together-ai) | ✅ | ✅ |
| <img src="https://www.perplexity.ai/favicon.svg" width=35> | [Perplexity](https://portkey.ai/docs/welcome/integration-guides/perplexity-ai) | ✅ | ✅ |
| <img src="https://docs.mistral.ai/img/favicon.ico" width=35> | [Mistral](https://portkey.ai/docs/welcome/integration-guides/mistral-ai) | ✅ | ✅ |
| <img src="https://docs.nomic.ai/img/nomic-logo.png" width=35> | [Nomic](https://portkey.ai/docs/welcome/integration-guides/nomic) | ✅ | ✅ |
| <img src="https://files.readme.io/d38a23e-small-studio-favicon.png" width=35> | [AI21](https://portkey.ai/docs/welcome/integration-guides) | ✅ | ✅ |
| <img src="https://platform.stability.ai/small-logo-purple.svg" width=35> | [Stability AI](https://portkey.ai/docs/welcome/integration-guides/stability-ai) | ✅ | ✅ |
| <img src="https://deepinfra.com/_next/static/media/logo.4a03fd3d.svg" width=35> | [DeepInfra](https://portkey.ai/docs/welcome/integration-guides) | ✅ | ✅ |
| <img src="https://ollama.com/public/ollama.png" width=35> | [Ollama](https://portkey.ai/docs/welcome/integration-guides/ollama) | ✅ | ✅ |
| <img src="https://novita.ai/favicon.ico" width=35> | Novita AI | ✅ | ✅ | `/chat/completions`, `/completions` |
> [サポートされている200以上のモデルの完全なリストを表示](https://portkey.ai/docs/welcome/what-is-portkey#ai-providers-supported)
<br>
<br>
## エージェント
ゲートウェイは、人気のあるエージェントフレームワークとシームレスに統合されます。[ドキュメントを読む](https://docs.portkey.ai/docs/welcome/agents)。
| フレームワーク | 200以上のLLMを呼び出す | 高度なルーティング | キャッシング | ロギングとトレース* | オブザーバビリティ* | プロンプト管理* |
|------------------------------|--------|-------------|---------|------|---------------|-------------------|
| [Autogen](https://docs.portkey.ai/docs/welcome/agents/autogen) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [CrewAI](https://docs.portkey.ai/docs/welcome/agents/crewai) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [LangChain](https://docs.portkey.ai/docs/welcome/agents/langchain-agents) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [Phidata](https://docs.portkey.ai/docs/welcome/agents/phidata) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [Llama Index](https://docs.portkey.ai/docs/welcome/agents/llama-agents) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [Control Flow](https://docs.portkey.ai/docs/welcome/agents/control-flow) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [独自のエージェントを構築する](https://docs.portkey.ai/docs/welcome/agents/bring-your-own-agents) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
<br>
*ホストされたアプリでのみ利用可能です。詳細なドキュメントは[こちら](https://docs.portkey.ai/docs/welcome/agents)をご覧ください。
## 機能
<table width=100%>
<tr>
<td width="50%">
<strong><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/fallbacks">フォールバック</a></strong><br/>
失敗したリクエストに対して別のプロバイダーやモデルにフォールバックします。トリガーするエラーを指定できます。アプリケーションの信頼性を向上させます。
<br><br>
<img src="https://framerusercontent.com/images/gmlOW8yeKP2pGuIsObM6gKLzeMI.png" height=100 />
</td>
<td width="50%">
<strong><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/automatic-retries">自動リトライ</a></strong><br/>
失敗したリクエストを最大5回自動的にリトライします。指数関数的バックオフ戦略により、リトライ試行の間隔を空けてネットワークの過負荷を防ぎます。
<br><br>
<img src="https://github.com/roh26it/Rubeus/assets/971978/8a6e653c-94b2-4ba7-95c7-93544ee476b1" height=100 />
</td>
</tr>
</table>
<table width="100%">
<tr>
<td width="50%">
<strong><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/load-balancing">ロードバランシング</a></strong><br/>
複数のAPIキーやAIプロバイダー間でLLMリクエストを重み付けして分散させ、高可用性と最適なパフォーマンスを確保します。
<br><br>
<img src="https://framerusercontent.com/images/6EWuq3FWhqrPe3kKLqVspevi4.png" height=100 />
</td>
<td width="50%">
<strong><a href="https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/request-timeouts">リクエストタイムアウト</a></strong></br><br/>
応答しないLLMリクエストを自動的に終了させるために、詳細なリクエストタイムアウトを設定します。
<br><br>
<img src="https://github.com/vrushankportkey/gateway/assets/134934501/b23b98b2-6451-4747-8898-6847ad8baed4" height=100 />
</td>
</tr>
</table>
</table>
<table width="100%">
<tr>
<td width="50%">
<strong><a href="https://docs.portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/multimodal-capabilities">マルチモーダルLLMゲートウェイ</a></strong><br/>
ビジョン、オーディオ(テキストから音声、音声からテキスト)、画像生成モデルを複数のプロバイダーから呼び出すことができます — すべてOpenAIのシグネチャを使用して
<br><br>
<img src="https://docs.portkey.ai/~gitbook/image?url=https%3A%2F%2F2878743244-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fy3MCfQqftZOnHqSmVV5x%252Fuploads%252FOVuOxN4uFdBp1BdXX4E6%252Fmultimodal-icon.png%3Falt%3Dmedia%26token%3Db8b7bd49-0194-4d2f-89d4-c6633a872372&width=768&dpr=2&quality=100&sign=f51129a9&sv=1" height=100 />
</td>
<td width="50%">
<strong><a href="https://docs.portkey.ai/docs/product/guardrails">ガードレール</a></strong></br><br/>
指定されたチェックに従ってLLMの入力と出力をリアルタイムで検証します。独自のチェックを作成するか、20以上の事前構築されたガードレールから選択できます。
<br><br>
<img src="https://docs.portkey.ai/~gitbook/image?url=https%3A%2F%2F2878743244-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fy3MCfQqftZOnHqSmVV5x%252Fuploads%252FDFkhZpqtBfQMIW9BhVum%252Fguardrails-icon.png%3Falt%3Dmedia%26token%3D91cfe226-5ce9-44b3-a0e8-be9f3ae3917f&width=768&dpr=2&quality=100&sign=73608afc&sv=1" height=100 />
</td>
</tr>
</table>
**これらの機能は、`x-portkey-config`ヘッダーまたはSDKの`config`パラメータに追加されたゲートウェイ設定を通じて構成されます。**
以下は、上記の機能を示すサンプル設定JSONです。すべての機能はオプションです。
```json
{
"retry": { "attempts": 5 },
"request_timeout": 10000,
"strategy": { "mode": "fallback" }, // または 'loadbalance' など
"targets": [{
"provider": "openai",
"api_key": "sk-***"
},{
"strategy": {"mode": "loadbalance"}, // オプションのネスト
"targets": {...}
}]
}
```
次に、APIリクエストに設定を使用します。
### ゲートウェイ設定の使用
リクエストで設定オブジェクトを使用する方法については、[こちらのガイド](https://portkey.ai/docs/api-reference/config-object)をご覧ください。
<br>
## ゲートウェイエンタープライズバージョン
AIアプリを<ins>信頼性</ins>と<ins>将来の互換性</ins>を高め、完全な<ins>データセキュリティ</ins>と<ins>プライバシー</ins>を確保します。
✅ セキュアなキー管理 - ロールベースのアクセス制御とトラッキングのため<br>
✅ シンプルでセマンティックなキャッシング - 繰り返しのクエリを高速に提供し、コストを削減<br>
✅ アクセス制御とインバウンドルール - 接続できるIPと地域を制御<br>
✅ PII削除 - リクエストから自動的に機密データを削除し、意図しない露出を防止<br>
✅ SOC2、ISO、HIPAA、GDPRコンプライアンス - ベストセキュリティプラクティスのため<br>
✅ プロフェッショナルサポート - 機能の優先順位付けとともに<br>
[エンタープライズデプロイメントについての相談を予約する](https://portkey.sh/demo-22)
<br>
## 貢献
最も簡単な貢献方法は、`good first issue`タグの付いた問題を選ぶことです 💪。貢献ガイドラインは[こちら](/.github/CONTRIBUTING.md)をご覧ください。
バグ報告?[こちらで提出](https://github.com/Portkey-AI/gateway/issues) | 機能リクエスト?[こちらで提出](https://github.com/Portkey-AI/gateway/issues)
<br>
## コミュニティ
世界中の成長するコミュニティに参加して、AIに関するヘルプ、アイデア、ディスカッションを行いましょう。
- 公式[ブログ](https://portkey.ai/blog)を閲覧する
- [Discord](https://portkey.ai/community)でリアルタイムチャット
- [Twitter](https://twitter.com/PortkeyAI)でフォロー
- [LinkedIn](https://www.linkedin.com/company/portkey-ai/)で接続
- [日本語のドキュメント](./.github/README.jp.md)を読む
<!-- - [YouTube](https://www.youtube.com/channel/UCZph50gLNXAh1DpmeX8sBdw)で訪問 -->
<!-- - [Devコミュニティ](https://dev.to/portkeyai)に参加 -->
<!-- - [Stack Overflow](https://stackoverflow.com/questions/tagged/portkey)で#portkeyタグの質問を閲覧 -->

================================================
FILE: .github/SECURITY.md
================================================
# Security Policy
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| 1.x.x | :white_check_mark: |
## Reporting a Vulnerability
Please report any security vulnerabilities at support@portkey.ai
================================================
FILE: .github/SUPPORT.md
================================================
## How to file issues and get help
This project uses GitHub Issues to track bugs and feature requests. Please search the existing issues before filing new issues to avoid duplicates.
For new issues, file your bug or feature request as a new Issue.
For help and questions about using this project, please contact `support@portkey.ai`. Join the community discussions [here](https://discord.com/invite/DD7vgKK299).
================================================
FILE: .github/cn.CODE_OF_CONDUCT.md
================================================
<p align="right">
<a href=".github\CODE_OF_CONDUCT.md">English</a>|<strong>中文</strong>
</p>
# 贡献者公约行为准则
## 我们的承诺
我们作为成员、贡献者和领导者,承诺参与我们的
社区对每个人来说是一个无骚扰的体验,无论他们的年龄、体型、可见或不可见的残疾、种族、性特征、性别认同和表达、经验水平、教育、社会经济地位、国籍、个人外表、种族、宗教或性别认同和取向。
我们承诺以促进开放、欢迎、多元、包容和健康的社区的方式行动和互动。
## 我们的标准
对于有助于我们社区积极环境的行为举例包括:
* 对他人表现出同理心和善意
* 尊重不同的意见、观点和经验
* 优雅地给予并接受建设性反馈
* 承担责任并向受我们错误影响的人道歉,
并从经验中学习
* 关注的不仅是我们作为个体的最佳利益,而是整个社区的最佳利益
不可接受的行为举例包括:
* 使用性语言或图像,以及任何形式的性关注或
进步
* 恶意挑衅、侮辱性或贬损性评论,以及个人或政治攻击
* 公开或私下骚扰
* 在未经明确许可的情况下发布他人的私人信息,如实际地址或电子邮件地址
* 其他在专业环境中可能被合理视为不适当的行为
## 执行责任
社区领导者负责澄清和执行我们可接受行为的标准,并将采取适当和公平的纠正措施以响应他们认为不当、威胁性、冒犯性或有害的任何行为。
社区领导者有权利和责任移除、编辑或拒绝不符合本行为准则的评论、提交、代码、wiki编辑、问题以及其他贡献,并在适当时候沟通调节决策的原因。
## 范围
本行为准则适用于所有社区空间,并且当个人在公共空间正式代表社区时也适用。代表我们的社区的例子包括使用官方电子邮件地址、通过官方社交媒体账户发布,或者在在线或离线活动中担任指定代表。
## 执行
滥用、骚扰或以其他方式不可接受的行为可向负责执行的社区领导者报告到
support@portkey.ai。
所有投诉将进行及时和公正的审查和调查。
所有社区领导者都有义务尊重任何事件报告者的隐私和安全。
## 执行指南
社区领导者将根据以下社区影响指南确定他们认为违反本行为准则的任何行为的后果:
### 1. 更正
**社区影响**:使用不当的语言或其他在社区中被认为不专业或不受欢迎的行为。
**后果**:社区领导者将发出私人书面警告,提供违规行为的性质的清晰说明以及解释为什么行为不当。可能会要求公开道歉。
### 2. 警告
**社区影响**:通过单一事件或一系列行动的违规行为。
**后果**:警告连同持续行为的后果。不得与涉事人员进行互动,包括与执行行为准则的人进行未经请求的互动,在指定时间内。这包括避免在社区空间以及像社交媒体这样的外部渠道的互动。违反这些条款可能会导致临时或永久禁止。
### 3. 临时禁止
**社区影响**:严重违反社区标准,包括持续不当行为。
**后果**:在指定时间内禁止与社区进行任何形式的互动或公开沟通。在此期间,不允许与涉事人员进行公开或私下互动,包括与执行行为准则的人进行未经请求的互动。违反这些条款可能会导致永久禁止。
### 4. 永久禁止
**社区影响**:展现违反社区标准的行为模式,包括持续不当行为,骚扰个体,或对个体或群体的侵犯性或贬低性行为。
**后果**:永久禁止在社区内进行任何形式的公共互动。
## 归属
本行为准则改编自 [Contributor Covenant][homepage],
2.0版本,可在
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html 查看。
社区影响指南的灵感来自 [Mozilla 的行为准则执行阶梯](https://github.com/mozilla/diversity)。
[homepage]: https://www.contributor-covenant.org
有关本行为准则的常见问题解答,请参见
https://www.contributor-covenant.org/faq。翻译版本可在
https://www.contributor-covenant.org/translations 查看。
================================================
FILE: .github/pull_request_template.md
================================================
**Description:** (required)
- Detailed change 1
- Detailed change 2
**Tests Run/Test cases added:** (required)
- [ ] Description of test case
**Type of Change:**
<!-- Put an 'x' in the boxes that apply -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update
- [ ] Refactoring (no functional changes)
================================================
FILE: .github/workflows/check_code_formatting.yml
================================================
name: Check Prettier Formatting
on:
pull_request:
branches:
- main
jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20.x'
- name: Install dependencies
run: npm install
- name: Check formatting
run: npm run format:check
================================================
FILE: .github/workflows/docker_publish.yml
================================================
name: Publish Docker image
on:
release:
types: [published]
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKER_ORGANISATION }}/gateway
tags: |
type=raw,value=latest
type=pep440,pattern={{version}},value=${{ github.event.release.tag_name }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
================================================
FILE: .github/workflows/link-checker.yml
================================================
name: Check Markdown links
on:
push:
paths:
- '**/*.md' # Only run when markdown files change
pull_request:
branches:
- main
schedule:
- cron: '0 0 * * 0' # Run weekly on Sundays
workflow_dispatch: # Allows manual triggering
jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Link Checker
uses: lycheeverse/lychee-action@v1.8.0
with:
args: --verbose --no-progress './**/*.md'
fail: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Issue If Failed
if: failure()
uses: actions/github-script@v6
with:
script: |
const title = '🔗 Broken links found in documentation';
const body = 'The link checker found broken links in the documentation. Please check the [workflow run](${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID}) for details.';
const existingIssues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'documentation,broken-links',
});
const issueExists = existingIssues.data.some(issue => issue.title === title);
if (!issueExists) {
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
body: body,
labels: ['documentation', 'broken-links']
});
}
================================================
FILE: .github/workflows/npm_publish.yml
================================================
name: Publish to NPM
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Publish package on NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
================================================
FILE: .github/workflows/run_tests.yml
================================================
name: Gateway Tests
on:
issue_comment:
types: [created]
jobs:
gateway-tests:
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'run tests') }}
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout head
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Start gateway and run tests
id: run-tests
continue-on-error: true
run: |
npm run build/start-server.js &
echo "Waiting for gateway to start..."
while ! curl -s http://localhost:8787 > /dev/null; do
sleep 1
done
echo "Gateway is ready. Running tests..."
npm run test:gateway
- name: Update PR Check
uses: actions/github-script@v6
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
try {
const { data: pull_request } = await github.rest.pulls.get({
owner,
repo,
pull_number: issue_number,
});
const sha = pull_request.head.sha;
await github.rest.checks.create({
owner,
repo,
name: 'Gateway Tests (Comment Triggered)',
head_sha: sha,
status: 'completed',
conclusion: '${{ steps.run-tests.outcome }}',
output: {
title: 'Gateway Test Results',
summary: 'Gateway tests have completed.',
text: 'These tests were triggered by a comment on the PR.'
},
});
console.log('Check run created successfully');
} catch (error) {
console.error('Error creating check run:', error);
core.setFailed(`Action failed with error: ${error}`);
}
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
================================================
FILE: .github/workflows/triage-label.yml
================================================
name: Auto Triage Label
on:
issues:
types: [opened]
jobs:
label_issues:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- uses: actions/checkout@v4.1.1
- name: Add Triage Label
uses: actions/github-script@v7.0.1
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['triage']
})
github-token: ${{secrets.GITHUB_TOKEN}}
================================================
FILE: .gitignore
================================================
# Local configuration file
conf.json
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.dev.vars
# Rollup build dir
build
.DS_Store
# Wrangler temp directory
.wrangler
# IntelliJ Idea
.idea
plugins/**/.creds.json
plugins/**/creds.json
plugins/**/.parameters.json
src/handlers/tests/.creds.json
.cursor/
================================================
FILE: .husky/pre-commit
================================================
npm run format:check || (npm run format && return 1)
================================================
FILE: .husky/pre-push
================================================
npm run pre-push
================================================
FILE: .prettierignore
================================================
node_modules
package-lock.json
build
.wrangler
public
wrangler.toml
================================================
FILE: .prettierrc
================================================
{
"semi": true,
"tabWidth": 2,
"printWidth": 80,
"endOfLine": "lf",
"singleQuote": true,
"arrowParens": "always",
"bracketSpacing": true,
"trailingComma": "es5"
}
================================================
FILE: .vscode/launch.json
================================================
{
/*
1. steps to run wrangler debugger (https://blog.cloudflare.com/debugging-cloudflare-workers/)
- run `npm run dev` in a terminal
- in debug and run tab, select 'Wrangler debug' and run
- add a breakpoint and verify
2. Steps tp run node debugger
- In debug tab select "Node debug" and run
- add a breakpoint and verify
*/
"version": "0.2.0",
"configurations": [
{
"name": "Wrangler debug",
"type": "node",
"request": "attach",
"port": 9229,
"cwd": "/",
"resolveSourceMapLocations": null,
"attachExistingChildren": false,
"autoAttachChildProcesses": false
},
{
"type": "node",
"request": "launch",
"name": "Node debug",
"runtimeExecutable": "tsx",
"runtimeArgs": ["${workspaceFolder}/build/src/start-server.js"],
"sourceMaps": true,
"outFiles": ["${workspaceFolder}/build/**/*.js"],
"sourceMapPathOverrides": {
"../src/*": "${workspaceFolder}/src/*"
},
"skipFiles": ["<node_internals>/**"],
"preLaunchTask": "npx tsc",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"postDebugTask": "cleanup build"
}
]
}
================================================
FILE: .vscode/tasks.json
================================================
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "npx tsc",
"command": "npx",
"args": [
"tsc",
"--sourcemap",
"true",
"--outDir",
"${workspaceFolder}/build"
],
"problemMatcher": ["$tsc"],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"type": "shell",
"label": "cleanup build",
"command": "rm",
"args": ["-rf", "${workspaceFolder}/build"],
"problemMatcher": [],
"group": "build",
"presentation": {
"reveal": "always",
"panel": "new"
}
}
]
}
================================================
FILE: CLAUDE.md
================================================
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is the **Portkey AI Gateway** - a fast, reliable AI gateway that routes requests to 250+ LLMs with sub-1ms latency. It's built with Hono framework for TypeScript/JavaScript and can be deployed to multiple environments including Cloudflare Workers, Node.js servers, and Docker containers.
## Development Commands
### Core Development
- `npm run dev` - Start development server using Wrangler (Cloudflare Workers)
- `npm run dev:node` - Start development server using Node.js
- `npm run build` - Build the project for production
- `npm run build-plugins` - Build the plugin system
### Testing
- `npm run test:gateway` - Run tests for the main gateway code (src/)
- `npm run test:plugins` - Run tests for plugins
- `jest src/` - Run specific gateway tests
- `jest plugins/` - Run specific plugin tests
### Code Quality
- `npm run format` - Format code with Prettier
- `npm run format:check` - Check code formatting
- `npm run pretty` - Alternative format command
### Deployment
- `npm run deploy` - Deploy to Cloudflare Workers
- `npm run start:node` - Start production Node.js server
## Architecture
### Core Components
**Main Application (`src/index.ts`)**
- Hono-based HTTP server with middleware pipeline
- Handles multiple AI provider integrations
- Routes: `/v1/chat/completions`, `/v1/completions`, `/v1/embeddings`, etc.
**Provider System (`src/providers/`)**
- Modular provider implementations (OpenAI, Anthropic, Azure, etc.)
- Each provider has standardized interface: `api.ts`, `chatComplete.ts`, `embed.ts`
- Provider configs define supported features and transformations
**Middleware Pipeline**
- `requestValidator` - Validates incoming requests
- `hooks` - Pre/post request hooks
- `memoryCache` - Response caching
- `logger` - Request/response logging
- `portkey` - Core Portkey-specific middleware for routing, guardrails, etc.
**Plugin System (`plugins/`)**
- Guardrail plugins for content filtering, PII detection, etc.
- Each plugin has `manifest.json` defining capabilities
- Plugins are built separately with `npm run build-plugins`
### Key Concepts
**Configs** - JSON configurations that define:
- Provider routing and fallbacks
- Load balancing strategies
- Guardrails and content filtering
- Caching and retry policies
**Handlers** - Route-specific request processors in `src/handlers/`
- Each AI API endpoint has dedicated handler
- Stream handling for real-time responses
- WebSocket support for realtime APIs
## File Structure
- `src/providers/` - AI provider integrations
- `src/handlers/` - API endpoint handlers
- `src/middlewares/` - Request/response middleware
- `plugins/` - Guardrail and validation plugins
- `cookbook/` - Example integrations and use cases
- `conf.json` - Runtime configuration
## Testing Strategy
Tests are organized by component:
- `src/tests/` - Core gateway functionality tests
- `src/handlers/__tests__/` - Handler-specific tests
- `plugins/*/**.test.ts` - Plugin tests
- Test timeout: 30 seconds (configured in jest.config.js)
## Configuration
The gateway uses `conf.json` for runtime configuration. Sample config available in `conf_sample.json`.
Key environment variables and configuration handled through Hono's adapter system for multi-environment deployment.
================================================
FILE: Dockerfile
================================================
# Use the official Node.js runtime as a parent image
FROM node:20-alpine AS build
# Set the working directory in the container
WORKDIR /app
# Copy package.json and package-lock.json to the working directory
COPY package*.json ./
COPY patches ./
# Upgrade system packages
RUN apk upgrade --no-cache
# Upgrade npm to version 10.9.2
RUN npm install -g npm@10.9.2
# Install app dependencies
RUN npm install
# Copy the rest of the application code
COPY . .
# Build the application and clean up
RUN npm run build \
&& rm -rf node_modules \
&& npm install --omit=dev
# Use the official Node.js runtime as a parent image
FROM node:20-alpine
# Upgrade system packages
RUN apk upgrade --no-cache
# Upgrade npm to version 10.9.2
RUN npm install -g npm@10.9.2
# Set the working directory in the container
WORKDIR /app
# Copy the build directory, node_modules, and package.json to the working directory
COPY --from=build /app/build /app/build
COPY --from=build /app/node_modules /app/node_modules
COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/patches /app/patches
# Expose port 8787
EXPOSE 8787
ENTRYPOINT ["npm"]
CMD ["run", "start:node"]
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2024 Portkey, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
<p align="right">
<strong>English</strong> | <a href="./.github/README.cn.md">中文</a> | <a href="./.github/README.jp.md">日本語</a>
</p>
> [!IMPORTANT]
> :rocket: Gateway 2.0 (Pre-Release) Portkey's core enterprise gateway is merging into open-source with our 2.0 release. You can try the pre-release branch [here](https://github.com/portkey-ai/gateway/tree/2.0.0).
> Read more about what's next for Portkey in our [**Series A announcement**](https://portkey.wiki/rohit-a).
<div align="center">
🆕 **[Portkey Models](https://github.com/Portkey-AI/models)** - Open-source LLM pricing for 2,300+ models across 40+ providers. [Explore →](https://portkey.ai/models)
# AI Gateway
#### Route to 250+ LLMs with 1 fast & friendly API
<img src="https://cfassets.portkey.ai/sdk.gif" width="550px" alt="Portkey AI Gateway Demo showing LLM routing capabilities" style="margin-left:-35px">
[Docs](https://portkey.wiki/gh-1) | [Enterprise](https://portkey.wiki/gh-2) | [Hosted Gateway](https://portkey.wiki/gh-3) | [Changelog](https://portkey.wiki/gh-4) | [API Reference](https://portkey.wiki/gh-5)
[](./LICENSE)
[](https://portkey.wiki/gh-6)
[](https://portkey.wiki/gh-7)
[](https://portkey.wiki/gh-8)
[](https://portkey.wiki/gh-9)
<a href="https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/quickcreate?stackName=portkey-gateway&templateURL=https://portkey-gateway-ec2-quicklaunch.s3.us-east-1.amazonaws.com/portkey-gateway-ec2-quicklaunch.template.yaml"><img src="https://img.shields.io/badge/Deploy_to_EC2-232F3E?style=for-the-badge&logo=amazonwebservices&logoColor=white" alt="Deploy to AWS EC2" width="105"/></a> [](https://deepwiki.com/Portkey-AI/gateway)
</div>
<br/>
The [**AI Gateway**](https://portkey.wiki/gh-10) is designed for fast, reliable & secure routing to 1600+ language, vision, audio, and image models. It is a lightweight, open-source, and enterprise-ready solution that allows you to integrate with any language model in under 2 minutes.
- [x] **Blazing fast** (<1ms latency) with a tiny footprint (122kb)
- [x] **Battle tested**, with over 10B tokens processed everyday
- [x] **Enterprise-ready** with enhanced security, scale, and custom deployments
<br>
#### What can you do with the AI Gateway?
- Integrate with any LLM in under 2 minutes - [Quickstart](#quickstart-2-mins)
- Prevent downtimes through **[automatic retries](https://portkey.wiki/gh-11)** and **[fallbacks](https://portkey.wiki/gh-12)**
- Scale AI apps with **[load balancing](https://portkey.wiki/gh-13)** and **[conditional routing](https://portkey.wiki/gh-14)**
- Protect your AI deployments with **[guardrails](https://portkey.wiki/gh-15)**
- Go beyond text with **[multi-modal capabilities](https://portkey.wiki/gh-16)**
- Explore **[agentic workflow](https://portkey.wiki/gh-17)** integrations
- Manage MCP servers with enterprise auth & observability using **[MCP Gateway](https://portkey.ai/docs/product/mcp-gateway)**
<br><br>
> [!TIP]
> Starring this repo helps more developers discover the AI Gateway 🙏🏻
>
> 
>
<br>
<br>
## Quickstart (2 mins)
### 1. Setup your AI Gateway
```bash
# Run the gateway locally (needs Node.js and npm)
npx @portkey-ai/gateway
```
> The Gateway is running on `http://localhost:8787/v1`
>
> The Gateway Console is running on `http://localhost:8787/public/`
<sup>
Deployment guides:
<a href="https://portkey.wiki/gh-18"><img height="12" width="12" src="https://cfassets.portkey.ai/logo/dew-color.svg" /> Portkey Cloud (Recommended)</a>
<a href="./docs/installation-deployments.md#docker"><img height="12" width="12" src="https://cdn.simpleicons.org/docker/3776AB" /> Docker</a>
<a href="./docs/installation-deployments.md#nodejs-server"><img height="12" width="12" src="https://cdn.simpleicons.org/node.js/3776AB" /> Node.js</a>
<a href="./docs/installation-deployments.md#cloudflare-workers"><img height="12" width="12" src="https://cdn.simpleicons.org/cloudflare/3776AB" /> Cloudflare</a>
<a href="./docs/installation-deployments.md#replit"><img height="12" width="12" src="https://cdn.simpleicons.org/replit/3776AB" /> Replit</a>
<a href="./docs/installation-deployments.md"> Others...</a>
</sup>
### 2. Make your first request
<!-- <details open>
<summary>Python Example</summary> -->
```python
# pip install -qU portkey-ai
from portkey_ai import Portkey
# OpenAI compatible client
client = Portkey(
provider="openai", # or 'anthropic', 'bedrock', 'groq', etc
Authorization="sk-***" # the provider API key
)
# Make a request through your AI Gateway
client.chat.completions.create(
messages=[{"role": "user", "content": "What's the weather like?"}],
model="gpt-4o-mini"
)
```
<sup>Supported Libraries:
[<img height="12" width="12" src="https://cdn.simpleicons.org/javascript/3776AB" /> JS](https://portkey.wiki/gh-19)
[<img height="12" width="12" src="https://cdn.simpleicons.org/python/3776AB" /> Python](https://portkey.wiki/gh-20)
[<img height="12" width="12" src="https://cdn.simpleicons.org/gnubash/3776AB" /> REST](https://portkey.sh/gh-84)
[<img height="12" width="12" src="https://cdn.simpleicons.org/openai/3776AB" /> OpenAI SDKs](https://portkey.wiki/gh-21)
[<img height="12" width="12" src="https://cdn.simpleicons.org/langchain/3776AB" /> Langchain](https://portkey.wiki/gh-22)
[LlamaIndex](https://portkey.wiki/gh-23)
[Autogen](https://portkey.wiki/gh-24)
[CrewAI](https://portkey.wiki/gh-25)
[More..](https://portkey.wiki/gh-26)
</sup>
On the Gateway Console (`http://localhost:8787/public/`) you can see all of your local logs in one place.
<img src="https://github.com/user-attachments/assets/362bc916-0fc9-43f1-a39e-4bd71aac4a3a" width="400" />
### 3. Routing & Guardrails
`Configs` in the LLM gateway allow you to create routing rules, add reliability and setup guardrails.
```python
config = {
"retry": {"attempts": 5},
"output_guardrails": [{
"default.contains": {"operator": "none", "words": ["Apple"]},
"deny": True
}]
}
# Attach the config to the client
client = client.with_options(config=config)
client.chat.completions.create(
model="gpt-4o-mini",
messages=[{"role": "user", "content": "Reply randomly with Apple or Bat"}]
)
# This would always response with "Bat" as the guardrail denies all replies containing "Apple". The retry config would retry 5 times before giving up.
```
<div align="center">
<img src="https://portkey.ai/blog/content/images/size/w1600/2024/11/image-15.png" width=600 title="Request flow through Portkey's AI gateway with retries and guardrails" alt="Request flow through Portkey's AI gateway with retries and guardrails"/>
</div>
You can do a lot more stuff with configs in your AI gateway. [Jump to examples →](https://portkey.wiki/gh-27)
<br/>
### Enterprise Version (Private deployments)
<sup>
[<img height="12" width="12" src="https://cfassets.portkey.ai/amazon-logo.svg" /> AWS](https://portkey.wiki/gh-28)
[<img height="12" width="12" src="https://cfassets.portkey.ai/azure-logo.svg" /> Azure](https://portkey.wiki/gh-29)
[<img height="12" width="12" src="https://cdn.simpleicons.org/googlecloud/3776AB" /> GCP](https://portkey.wiki/gh-30)
[<img height="12" width="12" src="https://cdn.simpleicons.org/redhatopenshift/3776AB" /> OpenShift](https://portkey.wiki/gh-31)
[<img height="12" width="12" src="https://cdn.simpleicons.org/kubernetes/3776AB" /> Kubernetes](https://portkey.wiki/gh-85)
</sup>
The LLM Gateway's [enterprise version](https://portkey.wiki/gh-86) offers advanced capabilities for **org management**, **governance**, **security** and [more](https://portkey.wiki/gh-87) out of the box. [View Feature Comparison →](https://portkey.wiki/gh-32)
The enterprise deployment architecture for supported platforms is available here - [**Enterprise Private Cloud Deployments**](https://portkey.ai/docs/self-hosting/hybrid-deployments/architecture)
<a href="https://portkey.sh/demo-13"><img src="https://portkey.ai/blog/content/images/2024/08/Get-API-Key--5-.png" height=50 alt="Book an enterprise AI gateway demo" /></a><br/>
<br>
## MCP Gateway
[MCP Gateway](https://portkey.ai/docs/product/mcp-gateway) provides a centralized control plane for managing MCP (Model Context Protocol) servers across your organization.
- **Authentication** — Single auth layer at the gateway. Users authenticate once; your MCP servers receive verified requests
- **Access Control** — Control which teams and users can access which servers and tools. Revoke access instantly
- **Observability** — Every tool call logged with full context: who called what, parameters, response, latency
- **Identity Forwarding** — Forward user identity (email, team, roles) to MCP servers automatically
Works with Claude Desktop, Cursor, VS Code, and any MCP-compatible client. [Get started →](https://portkey.ai/docs/product/mcp-gateway/quickstart)
<br>
## Core Features
### Reliable Routing
- <a href="https://portkey.wiki/gh-37">**Fallbacks**</a>: Fallback to another provider or model on failed requests using the LLM gateway. You can specify the errors on which to trigger the fallback. Improves reliability of your application.
- <a href="https://portkey.wiki/gh-38">**Automatic Retries**</a>: Automatically retry failed requests up to 5 times. An exponential backoff strategy spaces out retry attempts to prevent network overload.
- <a href="https://portkey.wiki/gh-39">**Load Balancing**</a>: Distribute LLM requests across multiple API keys or AI providers with weights to ensure high availability and optimal performance.
- <a href="https://portkey.wiki/gh-40">**Request Timeouts**</a>: Manage unruly LLMs & latencies by setting up granular request timeouts, allowing automatic termination of requests that exceed a specified duration.
- <a href="https://portkey.wiki/gh-41">**Multi-modal LLM Gateway**</a>: Call vision, audio (text-to-speech & speech-to-text), and image generation models from multiple providers — all using the familiar OpenAI signature
- <a href="https://portkey.wiki/gh-42">**Realtime APIs**</a>: Call realtime APIs launched by OpenAI through the integrate websockets server.
### Security & Accuracy
- <a href="https://portkey.wiki/gh-88">**Guardrails**</a>: Verify your LLM inputs and outputs to adhere to your specified checks. Choose from the 40+ pre-built guardrails to ensure compliance with security and accuracy standards. You can <a href="https://portkey.wiki/gh-43">bring your own guardrails</a> or choose from our <a href="https://portkey.wiki/gh-44">many partners</a>.
- [**Secure Key Management**](https://portkey.wiki/gh-45): Use your own keys or generate virtual keys on the fly.
- [**Role-based access control**](https://portkey.wiki/gh-46): Granular access control for your users, workspaces and API keys.
- <a href="https://portkey.wiki/gh-47">**Compliance & Data Privacy**</a>: The AI gateway is SOC2, HIPAA, GDPR, and CCPA compliant.
### Cost Management
- [**Smart caching**](https://portkey.wiki/gh-48): Cache responses from LLMs to reduce costs and improve latency. Supports simple and semantic* caching.
- [**Usage analytics**](https://portkey.wiki/gh-49): Monitor and analyze your AI and LLM usage, including request volume, latency, costs and error rates.
- [**Provider optimization***](https://portkey.wiki/gh-89): Automatically switch to the most cost-effective provider based on usage patterns and pricing models.
### Collaboration & Workflows
- <a href="https://portkey.ai/docs/integrations/agents">**Agents Support**</a>: Seamlessly integrate with popular agent frameworks to build complex AI applications. The gateway seamlessly integrates with [Autogen](https://portkey.wiki/gh-50), [CrewAI](https://portkey.wiki/gh-51), [LangChain](https://portkey.wiki/gh-52), [LlamaIndex](https://portkey.wiki/gh-53), [Phidata](https://portkey.wiki/gh-54), [Control Flow](https://portkey.wiki/gh-55), and even [Custom Agents](https://portkey.wiki/gh-56).
- [**Prompt Template Management***](https://portkey.wiki/gh-57): Create, manage and version your prompt templates collaboratively through a universal prompt playground.
<br/><br/>
<sup>
* Available in hosted and enterprise versions
</sup>
<br>
## Portkey Models
Open-source LLM pricing database for 40+ providers - used by the Gateway for cost tracking.
[GitHub](https://github.com/Portkey-AI/models) | [Model Explorer](https://portkey.ai/models)
<br>
## Cookbooks
### ☄️ Trending
- Use models from [Nvidia NIM](/cookbook/providers/nvidia.ipynb) with AI Gateway
- Monitor [CrewAI Agents](/cookbook/monitoring-agents/CrewAI_with_Telemetry.ipynb) with Portkey!
- Comparing [Top 10 LMSYS Models](/cookbook/use-cases/LMSYS%20Series/comparing-top10-LMSYS-models-with-Portkey.ipynb) with AI Gateway.
### 🚨 Latest
* [Create Synthetic Datasets using Nemotron](/cookbook/use-cases/Nemotron_GPT_Finetuning_Portkey.ipynb)
* [Use the LLM Gateway with Vercel's AI SDK](/cookbook/integrations/vercel-ai.md)
* [Monitor Llama Agents with Portkey's LLM Gateway](/cookbook/monitoring-agents/Llama_Agents_with_Telemetry.ipynb)
[View all cookbooks →](https://portkey.wiki/gh-58)
<br/><br/>
## Supported Providers
Explore Gateway integrations with [45+ providers](https://portkey.wiki/gh-59) and [8+ agent frameworks](https://portkey.wiki/gh-90).
| | Provider | Support | Stream |
| -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | ------- | ------ |
| <img src="docs/images/openai.png" width=35 /> | [OpenAI](https://portkey.wiki/gh-60) | ✅ | ✅ |
| <img src="docs/images/azure.png" width=35> | [Azure OpenAI](https://portkey.wiki/gh-61) | ✅ | ✅ |
| <img src="docs/images/anyscale.png" width=35> | [Anyscale](https://portkey.wiki/gh-62) | ✅ | ✅ |
| <img src="https://upload.wikimedia.org/wikipedia/commons/2/2d/Google-favicon-2015.png" width=35> | [Google Gemini](https://portkey.wiki/gh-63) | ✅ | ✅ |
| <img src="docs/images/anthropic.png" width=35> | [Anthropic](https://portkey.wiki/gh-64) | ✅ | ✅ |
| <img src="docs/images/cohere.png" width=35> | [Cohere](https://portkey.wiki/gh-65) | ✅ | ✅ |
| <img src="https://assets-global.website-files.com/64f6f2c0e3f4c5a91c1e823a/654693d569494912cfc0c0d4_favicon.svg" width=35> | [Together AI](https://portkey.wiki/gh-66) | ✅ | ✅ |
| <img src="https://www.perplexity.ai/favicon.svg" width=35> | [Perplexity](https://portkey.wiki/gh-67) | ✅ | ✅ |
| <img src="https://docs.mistral.ai/img/favicon.ico" width=35> | [Mistral](https://portkey.wiki/gh-68) | ✅ | ✅ |
| <img src="https://docs.nomic.ai/img/nomic-logo.png" width=35> | [Nomic](https://portkey.wiki/gh-69) | ✅ | ✅ |
| <img src="https://files.readme.io/d38a23e-small-studio-favicon.png" width=35> | [AI21](https://portkey.wiki/gh-91) | ✅ | ✅ |
| <img src="https://platform.stability.ai/small-logo-purple.svg" width=35> | [Stability AI](https://portkey.wiki/gh-71) | ✅ | ✅ |
| <img src="https://deepinfra.com/_next/static/media/logo.4a03fd3d.svg" width=35> | [DeepInfra](https://portkey.sh/gh-92) | ✅ | ✅ |
| <img src="https://ollama.com/public/ollama.png" width=35> | [Ollama](https://portkey.wiki/gh-72) | ✅ | ✅ |
| <img src="https://novita.ai/favicon.ico" width=35> | [Novita AI](https://portkey.wiki/gh-73) | ✅ | ✅ | `/chat/completions`, `/completions` |
> [View the complete list of 200+ supported models here](https://portkey.wiki/gh-74)
<br>
<br>
## Agents
Gateway seamlessly integrates with popular agent frameworks. [Read the documentation here](https://portkey.wiki/gh-75).
| Framework | Call 200+ LLMs | Advanced Routing | Caching | Logging & Tracing* | Observability* | Prompt Management* |
|------------------------------|--------|-------------|---------|------|---------------|-------------------|
| [Autogen](https://portkey.wiki/gh-93) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [CrewAI](https://portkey.wiki/gh-94) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [LangChain](https://portkey.wiki/gh-95) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [Phidata](https://portkey.wiki/gh-96) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [Llama Index](https://portkey.wiki/gh-97) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [Control Flow](https://portkey.wiki/gh-98) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| [Build Your Own Agents](https://portkey.wiki/gh-99) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
| <img src="https://io.net/favicon.ico" width=35> | [IO Intelligence](https://io.net/intelligence) | ✅ | ✅ |
<br>
*Available on the [hosted app](https://portkey.wiki/gh-76). For detailed documentation [click here](https://portkey.wiki/gh-100).
## Gateway Enterprise Version
Make your AI app more <ins>reliable</ins> and <ins>forward compatible</ins>, while ensuring complete <ins>data security</ins> and <ins>privacy</ins>.
✅ Secure Key Management - for role-based access control and tracking <br>
✅ Simple & Semantic Caching - to serve repeat queries faster & save costs <br>
✅ Access Control & Inbound Rules - to control which IPs and Geos can connect to your deployments <br>
✅ PII Redaction - to automatically remove sensitive data from your requests to prevent indavertent exposure <br>
✅ SOC2, ISO, HIPAA, GDPR Compliances - for best security practices <br>
✅ Professional Support - along with feature prioritization <br>
[Schedule a call to discuss enterprise deployments](https://portkey.sh/demo-13)
<br>
## Contributing
The easiest way to contribute is to pick an issue with the `good first issue` tag 💪. Read the contribution guidelines [here](/.github/CONTRIBUTING.md).
Bug Report? [File here](https://portkey.wiki/gh-78) | Feature Request? [File here](https://portkey.wiki/gh-78)
### Getting Started with the Community
Join our weekly AI Engineering Hours every Friday (8 AM PT) to:
- Meet other contributors and community members
- Learn advanced Gateway features and implementation patterns
- Share your experiences and get help
- Stay updated with the latest development priorities
[Join the next session →](https://portkey.wiki/gh-101) | [Meeting notes](https://portkey.wiki/gh-102)
<br>
## Community
Join our growing community around the world, for help, ideas, and discussions on AI.
- View our official [Blog](https://portkey.wiki/gh-78)
- Chat with us on [Discord](https://portkey.wiki/community)
- Follow us on [Twitter](https://portkey.wiki/gh-79)
- Connect with us on [LinkedIn](https://portkey.wiki/gh-80)
- Read the documentation in [Japanese](./.github/README.jp.md)
- Visit us on [YouTube](https://portkey.wiki/gh-103)
- Join our [Dev community](https://portkey.wiki/gh-82)
<!-- - Questions tagged #portkey on [Stack Overflow](https://stackoverflow.com/questions/tagged/portkey) -->

================================================
FILE: conf.example.json
================================================
{
"plugins_enabled": [
"default",
"portkey",
"aporia",
"sydelabs",
"pillar",
"patronus",
"pangea",
"promptsecurity",
"panw-prisma-airs",
"walledai"
],
"credentials": {
"portkey": {
"apiKey": "..."
}
},
"cache": false,
"integrations": [
{
"provider": "anthropic",
"slug": "dev_team_anthropic",
"credentials": {
"apiKey": "sk-ant-"
},
"rate_limits": [
{
"type": "requests",
"unit": "rph",
"value": 3
},
{
"type": "tokens",
"unit": "rph",
"value": 3000
}
],
"models": [
{
"slug": "claude-3-7-sonnet-20250219",
"status": "active",
"pricing_config": null
}
]
}
]
}
================================================
FILE: cookbook/README.md
================================================
# Portkey Practitioners' Cookbooks
<img src="../docs/images/cookbook-header.png" height=300 alt="header" />
#### Strategies and examples for tackling the production challenges of LLMs with Portkey Gateway
[](https://portkey.ai/community)
[](https://twitter.com/portkeyai)
## Table of Contents
Please use the below table of contents to navigate through the cookbook.
### Latest Notebooks
- Use models from [Nvidia NIM](/cookbook/providers/nvidia.ipynb) with AI Gateway
- Monitor [Llama Agents](/cookbook/monitoring-agents/Llama_Agents_with_Telemetry.ipynb) with Portkey!
- Create [Synthetic Datasets](/cookbook/use-cases/Nemotron_GPT_Finetuning_Portkey.ipynb) using Nemotron-340B
- Comparing [Top 10 LMSYS Models](./use-cases/LMSYS%20Series/comparing-top10-LMSYS-models-with-Portkey.ipynb) with AI Gateway.
## getting-started
* [Gentle introduction to Portkey Gateway](./getting-started/gentle-introduction-to-portkey-gateway.ipynb)
* [Use Portkey cache to save LLM cost & time](./getting-started/enable-cache.md)
* [Retry automatically on LLM failures](./getting-started/automatic-retries-on-failures.md)
* [Image generation with Gateway](./getting-started/image-generation.ipynb)
* [Writing your first Gateway Config](./getting-started/writing-your-first-gateway-config.md)
* [Automatically Fallback from OpenAI to Azure](./getting-started/fallback-from-openai-to-azure.ipynb)
View the [official docs](https://portkey.ai/docs)
## providers
* [OpenAI](./providers/openai.ipynb)
* [Anthropic](./providers/anthropic.md)
* [Mistral](./providers/mistral.md)
* [Vercel AI](./integrations/vercel-ai.md)
* [Groq](./providers/groq.ipynb)
* [Mistral](./providers/mistral.ipynb)
* [Deepinfra](./providers/deepinfra.ipynb)
* [Segmind](./providers/segmind.ipynb)
* [Nvidia](./providers/nvidia.ipynb)
View the [full list of providers here](https://portkey.ai/docs/welcome/integration-guides).
## integrations
* [Langchain](./integrations/langchain.ipynb)
* [Llama Index](./integrations/llama-index.ipynb)
* [Instructor](./integrations/Instructor_with_Portkey.ipynb)
* [Phidata](./integrations/Phidata_with_Portkey.ipynb)
View the [full list of integrations here](https://portkey.ai/docs/welcome/integration-guides).
## monitoring-agents
* [Autogen](./monitoring-agents/Autogen_with_Telemetry.ipynb)
* [CrewAI](./monitoring-agents/CrewAI_with_Telemetry.ipynb)
* [Llama Agents](./monitoring-agents/Llama_Agents_with_Telemetry.ipynb)
* [ControlFlow](./monitoring-agents/ControlFlow_with_Telemetry.ipynb)
## contributing
This is a community-driven resource! We welcome ideas, improvements, quick fixes, and deeper contributions that help the community.
[Request Cookbooks here](https://github.com/portkey-ai/gateway/issues). Check out our contribution [guidelines here](../.github/CONTRIBUTING.md).
================================================
FILE: cookbook/getting-started/automatic-retries-on-failures.md
================================================
# Automatically retry requests to LLMs
A sudden timeout or error could harm the user experience and hurt your service's reputation if your application relies on an LLM for a critical feature. To prevent this, it's crucial to have a reliable retry mechanism in place. This will ensure that users are not left frustrated and can depend on your service.
Retrying Requests to Large Langauge Models (LLMs) can significantly increase your Gen AI app's reliability.
It can help you handle cases such as:
1. Cases that timed out (no response from the model)
2. Cases that returned a transient error from the model
In this cookbook, you will learn to use Portkey to automatically retry the requests on specific response status codes and control the times you want to retry.
## 1. Import and Authenticate Portkey Client SDK
Portkey forwards your requests to your desired model and relays the response to your app. Portkey’s Client SDK is one of several ways to make those API calls through the AI gateway.
To install it, type the following in your NodeJS environment:
```sh
npm install portkey-ai
```
Import `Portkey` and instantiate it using the Portkey API Key
```js
const portkey = new Portkey({
apiKey: 'xxxxrk',
virtualKey: 'maixxx4d'
});
```
At this point, it’s essential to understand that you instantiate the `portkey` instance with `apiKey` and `virtualKey` parameters. You can find the arguments for both of them in your Portkey Dashboard.
Visit the reference to [obtain the Portkey API key](https://portkey.ai/docs/api-reference/authentication) and learn [how to create Virtual Keys](https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/virtual-keys#creating-virtual-keys).
## 2. Gateway Configs to Automatically Retry
For the AI gateway to understand that you want to apply automatic retries to your requests, you must pass Gateway Configs in your request payload. Gateway Configs can be a JS Object or a JSON string.
A typical Gateway Config to automatically retry three times when you hit rate-limits:
```js
{
retry: {
attempts: 3,
on_status_codes: [429]
}
}
```
You created a `retry` object with `attempts` and `on_status_codes` keys. The value of `attempts` can be bumped up to `5` times to retry automatically, while `on_status_codes` is an optional key. By default, Portkey will attempt to retry on the status codes `[429, 500, 502, 503, 504]`.
Refer to the [101 on Gateway Configs](https://github.com/Portkey-AI/portkey-cookbook/blob/main/product/101-portkey-gateway-configs.md#a-reference-gateway-configs-from-the-ui) and [Automatic Retries](https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/automatic-retries).
## 3. Make API calls using Portkey Client SDK
You are now ready to make an API call through Portkey. While there are several ways to make API calls, in this cookbook, let’s pass the gateway configuration during the chat completion call.
```js
let response = await portkey.chat.completions.create(
{
model: 'gpt-4',
messages: [
{
role: 'user',
content: 'What are 7 wonders of the world?'
}
]
},
{
config: JSON.stringify({
retry: {
attempts: 3,
on_status_codes: [429]
}
})
}
);
console.log(response.choices[0].message.content);
```
The Portkey SDK adds the configs in the HTTP headers to apply automatic retries to our requests. Broadly, the signature of the chat completion method:
```js
await portkey.chat.completions.create( modelParmeters [, gatewayConfigs])
```
## 4. View the Logs
Now that you successfully know how to make API calls through Portkey, it’s also helpful to learn about Logs. You can find all requests sent through Portkey on the **Dashboard** > **Logs** page.

This page provides essential information such as time, cost, and response. Feel free to explore it!
Instead of using your own application-level looping or control structures to implement retries, you can use Portkey’s Gateway Configs to manage all of them.
<details>
<summary>See the full code</summary>
```js
import { Portkey } from 'portkey-ai';
const portkey = new Portkey({
apiKey: xxxx,
virtualKey: 'xaixxxxxxx2xx4d'
});
let response = await portkey.chat.completions.create(
{
model: 'gpt-4',
messages: [
{
role: 'user',
content: 'What are 7 wonders of the world?'
}
]
},
{
config: JSON.stringify({
retry: {
attempts: 3
}
})
}
);
console.log(response.choices[0].message.content);
```
</details>
================================================
FILE: cookbook/getting-started/enable-cache.md
================================================
# Prevent unnecessary LLM requests with the Portkey Cache
If you have multiple users of your GenAI app triggering the same or similar queries to your models, fetching LLM response from the models can be slow and expensive. This is because it requires multiple round trips from your app to the model and you may end up paying for the duplicate queries.
To avoid such unnecessary LLM requests, you can use Portkey as your first line of defense. It is highly effective and can be made to work across the 100+ LLMs it supports by simply making changes to a few lines of code.
## How Portkey Cache Works
All requests that have caching enabled on them will serve the subsequent responses from the Portkey’s cache.

Portkey offers two main ways of Caching techniques to enable on your requests — Simple and Semantic.
In short:
- Simple caching refers for identical input prompts to serve from cache.
- Semantic caching refers to an similarity threshold (uses cosine similarity) to serve from cache.
For detailed information, check out [this](https://portkey.ai/blog/reducing-llm-costs-and-latency-semantic-cache/) blog post.
## 1. Import and Authenticate Portkey Client SDK
You now have a brief mindmap of Portkey's approach to caching responses from LLMs.
Let's utilize the Portkey Client SDK to send chat completion requests and attach gateway configs, which in turn activate caching.
To install it, type the following in your NodeJS environment:
```sh
npm install portkey-ai
```
Instantiate Portkey instance
```js
const portkey = new Portkey({
apiKey: 'xxxxrk',
virtualKey: 'maixxx4d'
});
```
At this point, it’s essential to understand that you instantiate the `portkey` instance with `apiKey` and `virtualKey` parameters. You can find the arguments for both of them in your Portkey Dashboard.
Visit the reference to [obtain the Portkey API key](https://portkey.ai/docs/api-reference/authentication) and learn [how to create Virtual Keys](https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/virtual-keys#creating-virtual-keys).
## 2. Use Gateway Configs to enable Caching
The AI gateway caches your requests and serves it respecting the gateway configs on the request headers. The configs are a simple JS object or JSON string that contains following key-value pairs.
The `mode` key specifies the desired strategy of caching you want for your app.
```js
// Simple Caching
"cache": { "mode": "simple" }
// Semantic Caching
"cache": { "mode": "semantic" }
```
Next up, attach these configs to the request using Portkey SDK. The SDK accepts an `config` parameter that can accept these configurations as an argument. To learn about more ways, refer to the [101 on Gateway Configs](https://github.com/Portkey-AI/portkey-cookbook/blob/main/product/101-portkey-gateway-configs.md#a-reference-gateway-configs-from-the-ui).
## 3. Make API calls, Serve from Cache
We are now ready to put what we’ve learned so far into action. We plan on making two requests to an OpenAI model (as an example) while one of them has simple caching activated on it, while other has semantic caching enabled.
```js
// Simple Cache
let simpleCacheResponse = await portkey.chat.completions.create(
{
model: 'gpt-4',
messages: [
{
role: 'user',
content: 'What are 7 wonders of the world?'
}
]
},
{
config: JSON.stringify({
cache: {
mode: 'simple'
}
})
}
);
console.log('Simple Cached Response:\n', simpleCacheResponse.choices[0].message.content);
```
Whereas for semantic caching,
```js
let semanticCacheResponse = await portkey.chat.completions.create(
{
model: 'gpt-4',
messages: [
{
role: 'user',
content: 'List the 5 senses of Human beings?'
}
]
},
{
config: JSON.stringify({
cache: {
mode: 'semantic'
}
})
}
);
console.log('\nSemantically Cached Response:\n', semanticCacheResponse.choices[0].message.content);
```
On the console:
```sh
Simple Cached Response:
1. The Great Wall of China
2. Petra, Jordan
3. Christ the Redeemer Statue, Brazil
4. Machu Picchu, Peru
5. The Chichen Itza Pyramid, Mexico
6. The Roman Colosseum, Italy
7. The Taj Mahal, India
Semantically Cached Response:
1. Sight (Vision)
2. Hearing (Auditory)
3. Taste (Gustatory)
4. Smell (Olfactory)
5. Touch (Tactile)
```
Try experimenting with rephrasing the prompts in the `messages` array and see if you notice any difference in the time it takes to receive a response or the quality of the response itself.
Can you refresh the cache on demand? Yes, you can!
Can you control how long the cache remains active? Absolutely!
Explore the [docs](https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/cache-simple-and-semantic) on caching to know all the features available to control how you cache the LLM responses.
## 4. View Analytics and Logs
On the **Analytics** page, you can find Portkey's cache performance analytics under the Cache tab.

The **Logs** page displays a list of LLM calls that served responses from cache. The corresponding icon is activated when the cache is hit.

## Next steps
By leveraging simple and semantic caching, you can avoid unnecessary LLM requests, reduce latency, and provide a better user experience. So go ahead and experiment with the Portkey Cache in your own projects – the benefits are just a few lines of code away!
Some suggestions to experiment:
- Try using the configs from the [Portkey UI](https://github.com/Portkey-AI/portkey-cookbook/blob/main/ai-gateway/101-portkey-gateway-configs.md#a-reference-gateway-configs-from-the-ui) as a reference.
- Implement caching when there are [multiple targets](https://github.com/Portkey-AI/portkey-cookbook/blob/main/ai-gateway/how-to-setup-fallback-from-openai-to-azure-openai.md#2-creating-fallback-configs) in your gateway configs. (Here’s a [clue](https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/cache-simple-and-semantic#how-cache-works-with-configs))
<details>
<summary>See the full code</summary>
```js
import { Portkey } from 'portkey-ai';
const portkey = new Portkey({
apiKey: 'xxxxxk',
virtualKey: 'mxxxxxxxxd'
});
let simpleCacheResponse = await portkey.chat.completions.create(
{
model: 'gpt-4',
messages: [
{
role: 'user',
content: 'What are 7 wonders of the world?'
}
]
},
{
config: JSON.stringify({
cache: {
mode: 'simple'
}
})
}
);
console.log('Simple Cached Response:\n', simpleCacheResponse.choices[0].message.content);
let semanticCacheResponse = await portkey.chat.completions.create(
{
model: 'gpt-4',
messages: [
{
role: 'user',
content: 'List the 5 senses of Human beings?'
}
]
},
{
config: JSON.stringify({
cache: {
mode: 'semantic'
}
})
}
);
console.log('\nSemantically Cached Response:\n', semanticCacheResponse.choices[0].message.content);
```
</details>
================================================
FILE: cookbook/getting-started/fallback-from-openai-to-azure.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "view-in-github"
},
"source": [
"<a href=\"https://colab.research.google.com/github/Portkey-AI/portkey-cookbook/blob/main/ai-gateway/how_to_setup_fallback_from_openai_to_azure_openai.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Pln7ewgvA3Gs"
},
"source": [
"## How to Setup Fallback from OpenAI to Azure OpenAI\n",
"\n",
"Let’s say you’ve built an LLM-based app and deployed it to production. It relies on OpenAI’s gpt-4 model. It’s [Mar 12, 2023](https://status.portkey.ai/incident/339664), and suddenly your users find errors with the functionality of the app — “It doesn’t work!”\n",
"\n",
"It turns out that in the logs, the app has encountered [503 errors](https://platform.openai.com/docs/guides/error-codes) due to overloaded requests on the server-side. What could you do? If you are in such a situation, we have an answer for you: Portkey Fallbacks.\n",
"\n",
"Portkey Fallbacks can automatically switch your app's requests from one LLM provider to another, ensuring reliability by allowing you to fallback among multiple LLMs. This is especially useful given the unpredictable nature of LLM APIs. With Portkey, you can switch to a different LLM provider, such as Azure, when needed, making your app Production-Ready.\n",
"\n",
"In this cookbook, we will learn how to implement a fallback mechanism in our apps that allows us to automatically switch the LLM provider from OpenAI to Azure OpenAI with just a few lines of code. Both providers have the exact same set of models, but they are deployed differently. Azure OpenAI comes with its own deployment mechanisms, which are generally considered to be more reliable.\n",
"\n",
"<span style=\"text-decoration:underline;\">Prerequisites:</span>\n",
"\n",
"1. You have the [Portkey API Key](https://portkey.ai/docs/api-reference/authentication#obtaining-your-api-key). [ [Sign Up](https://portkey.ai) ]\n",
"2. You stored OpenAI and Azure OpenAI API keys as [virtual keys](https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/virtual-keys)."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "leMVtjKrBce2"
},
"source": [
"## 1. Import the SDK and authenticate with Portkey\n",
"\n",
"We start by importing Portkey SDK into our NodeJS project using npm and authenticate by passing the Portkey API Key."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "vOostjRiBfq_"
},
"outputs": [],
"source": [
"!pip install portkey-ai openai"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"id": "b_985bXCCGGZ"
},
"outputs": [],
"source": [
"from portkey_ai import Portkey\n",
"from google.colab import userdata\n",
"\n",
"PORTKEYAI_API_KEY=userdata.get('PORTKEY_API_KEY')\n",
"OPENAI_VIRTUAL_KEY=userdata.get('OPENAI_VIRTUAL_KEY')\n",
"\n",
"portkey = Portkey(\n",
" api_key=PORTKEYAI_API_KEY,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "cKbbE0t9DKV4"
},
"source": [
"## 2. Create Fallback Configs\n",
"\n",
"Next, we will create a configs object that influences the behavior of the request sent using Portkey.\n",
"\n",
"```json\n",
"{\n",
" strategy: {\n",
" mode: \"fallback\",\n",
" },\n",
" targets: [\n",
" {\n",
" virtual_key: OPENAI_VIRTUAL_KEY,\n",
" },\n",
" {\n",
" virtual_key: AZURE_OPENAI_VIRTUAL_KEY,\n",
" },\n",
" ],\n",
"}\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "RFjHxpzUCbUJ"
},
"source": [
"This configuration instructs Portkey to use a \\_fallback \\_strategy with the requests. The \\_targets_array lists the virtual keys of LLMs in the order Portkey should fallback to an alternative.\n",
"\n",
"Most users find it way more cleaner to define the configs in the Portkey UI and reference the config ID in the code. [Try it out](https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/configs#creating-configs).\n",
"\n",
"Add this configuration to the _portkey_ instance to apply the fallback behavior to all the requests."
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"id": "t_-VBo6ZDX2v"
},
"outputs": [],
"source": [
"from portkey_ai import Portkey\n",
"from google.colab import userdata\n",
"import json\n",
"\n",
"PORTKEYAI_API_KEY=userdata.get('PORTKEY_API_KEY')\n",
"OPENAI_VIRTUAL_KEY=userdata.get('OPENAI_VIRTUAL_KEY')\n",
"AZURE_OPENAI_VIRTUAL_KEY=userdata.get('AZURE_OPENAI_VIRTUAL_KEY')\n",
"\n",
"config_data = {\n",
" 'strategy': {\n",
" 'mode': \"fallback\",\n",
" },\n",
" 'targets': [\n",
" {\n",
" 'virtual_key': OPENAI_VIRTUAL_KEY,\n",
" },\n",
" {\n",
" 'virtual_key': AZURE_OPENAI_VIRTUAL_KEY,\n",
" },\n",
" ],\n",
"}\n",
"\n",
"\n",
"portkey = Portkey(\n",
" api_key=PORTKEYAI_API_KEY,\n",
" virtual_key=OPENAI_VIRTUAL_KEY,\n",
" config=json.dumps(config_data)\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "lBvXjINhEbxg"
},
"source": [
"Always reference the credentials from the environment variables to prevent exposure of any sensitive data. Portkey will automatically infer the LLM providers based on the passed virtual keys.\n",
"\n",
"> The Azure OpenAI virtual key only needs to be set up once, and it will then be accessible through Portkey in all subsequent API calls."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<details>\n",
"\n",
"<summary>Fallback Configs without virtual keys</summary>\n",
"\n",
"```json\n",
"{\n",
" \"strategy\": {\n",
" \"mode\": \"fallback\"\n",
" },\n",
" \"targets\": [\n",
" {\n",
" \"provider\": \"openai\",\n",
" \"api_key\": \"sk-xxxxxxxxpRT4xxxx5\"\n",
" },\n",
" {\n",
" \"provider\": \"azure-openai\",\n",
" \"api_key\": \"*******\"\n",
" }\n",
" ]\n",
"}\n",
"```\n",
"\n",
"</details>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "fQ5JMtO3EeFu"
},
"source": [
"## 3. Make a request\n",
"\n",
"All the requests will hit OpenAI since Portkey proxies all those requests to the target(s) we already specified. Notice that the changes to the requests do not demand any code changes in the business logic implementation. Smooth!"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "c8gYcOg3MOKq"
},
"outputs": [],
"source": [
"messages = [\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": \"What are the 7 wonders of the world?\"\n",
" }\n",
"]\n",
"\n",
"response = portkey.chat.completions.create(\n",
" messages = messages,\n",
" model = 'gpt-3.5-turbo'\n",
")\n",
"\n",
"print(response.choices[0].message.content) # Here is the plan"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "gehAN1uiMd2e"
},
"source": [
"When OpenAI returns any 4xx or 5xx errors, Portkey will automatically switch to Azure OpenAI to ensure the same specified model is used."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "DjDa1SXDMiGH"
},
"source": [
"## 4. View the Fallback Status in Logs\n",
"\n",
"Since all the requests go through Portkey, Portkey can log them for better observability of your app. You can find the specific requests by passing an _trace ID_. It can be any desired string name. In this case, `my-trace-id`"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "Lgg6X2VDMlZF"
},
"outputs": [],
"source": [
"response = portkey.with_options(trace_id=\"<my-trace-id>\").chat.completions.create(\n",
" messages = messages,\n",
" model = 'gpt-4'\n",
")\n",
"\n",
"print(response.choices[0].message.content)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "z_sY3uQbNH4W"
},
"source": [
"You can apply filter with Trace ID to list requests. Instances when the fallbacks are activated will highlight the fallback icon. The logs can be filtered by cost, tokens, status, config, trace id and so on.\n",
"\n",
"\n",
"\n",
"Learn more about [Logs](https://portkey.ai/docs/product/observability-modern-monitoring-for-llms/logs)."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "R2KpXJfcO80T"
},
"source": [
"## 5. Advanced: Fallback on Specific Status Codes\n",
"\n",
"Portkey provides finer control over the when it should apply fallback strategy to your requests to LLMs. You can define the configuration to condition based on specific status codes returned by the LLM provider."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "xD1AYPf1PDGQ"
},
"outputs": [],
"source": [
"from portkey_ai import Portkey\n",
"from google.colab import userdata\n",
"import json\n",
"\n",
"PORTKEYAI_API_KEY=userdata.get('PORTKEY_API_KEY')\n",
"OPENAI_VIRTUAL_KEY=userdata.get('OPENAI_VIRTUAL_KEY')\n",
"AZURE_OPENAI_VIRTUAL_KEY=userdata.get('AZURE_OPENAI_VIRTUAL_KEY')\n",
"\n",
"config_data = {\n",
" 'strategy': {\n",
" 'mode': \"fallback\",\n",
" 'on_status_codes': [429]\n",
" },\n",
" 'targets': [\n",
" {\n",
" 'virtual_key': OPENAI_VIRTUAL_KEY,\n",
" },\n",
" {\n",
" 'virtual_key': AZURE_OPENAI_VIRTUAL_KEY,\n",
" },\n",
" ],\n",
"}\n",
"\n",
"\n",
"portkey = Portkey(\n",
" api_key=PORTKEYAI_API_KEY,\n",
" virtual_key=OPENAI_VIRTUAL_KEY,\n",
" config=json.dumps(config_data)\n",
")\n",
"\n",
"messages = [\n",
" {\n",
" \"role\": \"user\",\n",
" \"content\": \"What are the 7 wonders of the world?\"\n",
" }\n",
"]\n",
"\n",
"response = portkey.chat.completions.create(\n",
" messages = messages,\n",
" model = 'gpt-3.5-turbo'\n",
")\n",
"\n",
"print(response.choices[0].message.content) # Here is the plan"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "znyPLa3uPT8L"
},
"source": [
"In the above case for all the request that are acknowledged with the status code of 429 will fallback from OpenAI to Azure OpenAI."
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "itZYQAdwPU0b"
},
"source": [
"## 6. Considerations\n",
"\n",
"That’s it; you can implement production-grade fallback mechanisms with just a few lines of code. While you are equipped with all the tools to implement fallbacks to your next GenAI app, here are few considerations:\n",
"\n",
"- The implementation of Fallback does not alter the quality of LLM outputs received by your app.\n",
"- Azure requires you to deploy specific models. Portkey will automatically trigger the chat completions endpoint using GPT4 if it is available instead of GPT3.5."
]
}
],
"metadata": {
"colab": {
"authorship_tag": "ABX9TyNTD3h7w6NbWJdNj5scDoZ7",
"include_colab_link": true,
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
================================================
FILE: cookbook/getting-started/fallback-from-stable-diffusion-to-dall-e.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/Portkey-AI/portkey-cookbook/blob/main/ai-gateway/set-up-fallback-from-stable-diffusion-to-dall-e.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"id": "4586cc53",
"metadata": {
"id": "4586cc53"
},
"source": [
"# Set up Fallback from Stable Diffusion to Dall-E\n",
"\n",
"Generative AI models have revolutionized text generation and opened up new possibilities for developers. What next? A new category of image generation models.\n",
"\n",
"This cookbook introduces Portkey’s multimodal AI gateway, which helps you switch between multiple image generation models without any code changes — all with OpenAI SDK. You will learn to set up fallbacks from Stable Diffusion to Dall-E."
]
},
{
"cell_type": "markdown",
"id": "42ae2283",
"metadata": {
"id": "42ae2283"
},
"source": [
"## 1. Integrate Image Gen Models with Portkey \n",
"\n",
"Begin by storing API keys in the Portkey Vault.\n",
"\n",
"To save your OpenAI and StabilityAI keys in the Portkey Vault:\n",
"1. Go to **portkey.ai**\n",
"2. Click **Virtual Keys** and then **Create**\n",
" 1. Enter **Name** and **API Key**,\n",
" 2. Hit **Create**\n",
"3. Copy the virtual key from the **KEY** column\n",
"\n",
"We successfully have set up virtual keys!\n",
"\n",
"For more information, refer the [docs](https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/virtual-keys).\n",
"\n",
"The multi-modal AI gateway will use these virtual keys in the future to apply a fallback mechanism to every request from your app."
]
},
{
"cell_type": "markdown",
"id": "5e2efe10",
"metadata": {
"id": "5e2efe10"
},
"source": [
"## 2. Making a call to Stability AI using OpenAI SDK\n",
"\n",
"With Portkey, you can call Stability AI models like SDXL right from inside the OpenAI SDK. Just change the `base_url` to Portkey Gateway and add `defaultHeaders` while instantiating your OpenAI client, and you're good to go\n",
"\n",
"Import the `openai` and `portkey_ai` libraries to send the requests, whereas the rest of the utility libraries will help decode the base64 response and print them onto Jupyter Notebook."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9c6ac821",
"metadata": {
"id": "9c6ac821"
},
"outputs": [],
"source": [
"from IPython.display import display\n",
"from PIL import Image\n",
"from openai import OpenAI\n",
"from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders\n",
"import requests, io, base64, json"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e6f4c81a",
"metadata": {
"id": "e6f4c81a"
},
"outputs": [],
"source": [
"PORTKEY_API_KEY=\"YOUR_PORTKEY_API_KEY_HERE\"\n",
"OPENAI_VIRTUAL_KEY=\"YOUR_OPENAI_VIRTUAL_KEY_HERE\"\n",
"CONFIG_ID=\"YOUR_CONFIG_ID_HERE\"\n",
"OPENAI_API_KEY=\"REDUNDANT\""
]
},
{
"cell_type": "markdown",
"id": "96aa498e",
"metadata": {
"id": "96aa498e"
},
"source": [
"Declare the arguments to pass to the parameters of OpenAI SDK and initialize a client instance."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6383332c",
"metadata": {
"id": "6383332c"
},
"outputs": [],
"source": [
"STABILITYAI_VIRTUAL_KEY=\"YOUR_STABILITYAI_VIRTUAL_KEY_HERE\"\n",
"\n",
"client = OpenAI(\n",
" api_key=\"REDUNDANT\",\n",
" base_url=PORTKEY_GATEWAY_URL,\n",
" default_headers=createHeaders(\n",
" provider=\"stabilityai\",\n",
" api_key=PORTKEY_API_KEY,\n",
" virtual_key=STABILITYAI_VIRTUAL_KEY,\n",
" )\n",
")"
]
},
{
"cell_type": "markdown",
"id": "75e47fca",
"metadata": {
"id": "75e47fca"
},
"source": [
"The `api_key` parameter is passed a random string since it’s redundant as the request will be handled through Portkey.\n",
"\n",
"To generate an image:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e15ab799",
"metadata": {
"scrolled": true,
"id": "e15ab799"
},
"outputs": [],
"source": [
"image = client.images.generate(\n",
" model=\"stable-diffusion-v1-6\",\n",
" prompt=\"Kraken in the milkyway galaxy\",\n",
" n=1,\n",
" size=\"1024x1024\",\n",
" response_format=\"b64_json\"\n",
")\n",
"\n",
"base64_image = image.data[0].b64_json\n",
"\n",
"image_data = base64.b64decode(base64_image)\n",
"\n",
"image = Image.open(io.BytesIO(image_data))\n",
"display(image)"
]
},
{
"cell_type": "markdown",
"id": "900e40aa",
"metadata": {
"id": "900e40aa"
},
"source": [
"The image you receive in the response is encoded in base64 format, which requires you to decode it before you can view it in the Jupyter Notebook. In addition, Portkey offers logging for observability. To find all the information for every request, simply check the requests on the **Dashboard > Logs**."
]
},
{
"cell_type": "markdown",
"id": "55edb172",
"metadata": {
"id": "55edb172"
},
"source": [
"## 3. Now, Setup a Fallback from SDXL to Dall-E\n",
"\n",
"Let’s learn how to enhance the reliability of your Stability AI requests by configuring automatic fallbacks to Dall-E in case of failures. You can use Gateway Configs on Portkey to implement this automated fallback logic. These configurations can be passed while creating your OpenAI client.\n",
"\n",
"From the Portkey Dashboard, open **Configs** and then click **Create**. In the config editor, write the JSON for Gateway Configs:\n",
"\n",
"```json\n",
"{\n",
" \"strategy\": {\n",
" \"mode\": \"fallback\"\n",
" },\n",
" \"targets\": [\n",
" {\n",
" \"virtual_key\": \"stability-ai-virtualkey\",\n",
" \"override_params\": {\n",
" \"model\": \"stable-diffusion-v1-6\"\n",
" }\n",
" },\n",
" {\n",
" \"virtual_key\": \"open-ai-virtual-key\",\n",
" \"override_params\": {\n",
" \"model\": \"dall-e-3\"\n",
" }\n",
" }\n",
" ]\n",
"}\n",
"```\n",
"\n",
"These configs tell the AI gateway to follow an `fallback` strategy, where the primary target to forward requests to is _Stability AI_ (automatically inferred from the virtual key) and then to _OpenAI_. The `override_params` let’s you override the default models for the provider. Finally, surprise surprise! — we also enabled caching with just one more key-value pair.\n",
"\n",
"Learn about [Gateway Configs](https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/configs) and [Caching](https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/cache-simple-and-semantic) from the docs.\n",
"\n",
"Hit **Save Config** on the top right corner and grab the **Config ID. **Next up, we are going to use the _Config ID _in our requests to activate fallback mechanism."
]
},
{
"cell_type": "markdown",
"id": "0681664d",
"metadata": {
"id": "0681664d"
},
"source": [
"## 4. Make a request with gateway configs \n",
"\n",
"Finally, the requests will be sent like we did with OpenAI SDK earlier, but with one specific difference - the `config` parameter. The request is sent through Portkey and uses saved gateway configs as references to activate the fallback mechanism."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e34d9797",
"metadata": {
"id": "e34d9797"
},
"outputs": [],
"source": [
"client = OpenAI(\n",
" api_key=OPENAI_API_KEY,\n",
" base_url=PORTKEY_GATEWAY_URL,\n",
" default_headers=createHeaders(\n",
" api_key=PORTKEY_API_KEY,\n",
" config=CONFIG_ID\n",
" )\n",
")\n",
"\n",
"image = client.images.generate(\n",
" model=\"stable-diffusion-v1-6\",\n",
" prompt=\"Harry Potter travelling the world using Portkey\",\n",
" n=1,\n",
" size=\"1024x1024\",\n",
" response_format=\"b64_json\"\n",
")\n",
"\n",
"base64_image = image.data[0].b64_json\n",
"\n",
"image_data = base64.b64decode(base64_image)\n",
"\n",
"image = Image.open(io.BytesIO(image_data))\n",
"display(image)"
]
},
{
"cell_type": "markdown",
"id": "1053e49e",
"metadata": {
"id": "1053e49e"
},
"source": [
"## Afterthoughts\n",
"\n",
"All the requests that go through Portkey will appear in the Logs page within the Portkey Dashboard. You can apply filters or even trace the specific set of requests. Check out [Request Tracing](https://portkey.ai/docs/product/observability-modern-monitoring-for-llms/traces). Simultaneously, a fallback icon is turned on for the log where the fallback is activated.\n",
"\n",
"Portkey supports multiple providers offering multimodal capabilities, such as OpenAI, Anthropic, and Stability AI, all accessible through a unified API interface following OpenAI Signature.\n",
"\n",
"For further exploration, why not [play with Vision capabilities](https://portkey.ai/docs/product/ai-gateway-streamline-llm-integrations/multimodal-capabilities/vision)?"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.18"
},
"colab": {
"provenance": [],
"include_colab_link": true
}
},
"nbformat": 4,
"nbformat_minor": 5
}
================================================
FILE: cookbook/getting-started/gentle-introduction-to-portkey-gateway.ipynb
================================================
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": []
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"source": [
"<h1 align=\"center\">\n",
" <a href=\"https://portkey.ai\">\n",
" <img width=\"300\" src=\"https://analyticsindiamag.com/wp-content/uploads/2023/08/Logo-on-white-background.png\" alt=\"portkey\">\n",
" </a>\n",
"</h1>"
],
"metadata": {
"id": "APmF3kxYFiCY"
}
},
{
"cell_type": "markdown",
"source": [
"[](https://colab.research.google.com/drive/1nQa-9EYcv9-O6VnwLATnVd9Q2wFtthOA?usp=sharing)"
],
"metadata": {
"id": "rAxc8aNDGMY2"
}
},
{
"cell_type": "markdown",
"source": [
"[Portkey](https://app.portkey.ai/) is the Control Panel for AI apps. With it's popular AI Gateway and Observability Suite, hundreds of teams ship reliable, cost-efficient, and fast apps.\n",
"\n",
"With Portkey, you can\n",
"\n",
" - Connect to 150+ models through a unified API,\n",
" - View 40+ metrics & logs for all requests,\n",
" - Enable semantic cache to reduce latency & costs,\n",
" - Implement automatic retries & fallbacks for failed requests,\n",
" - Add custom tags to requests for better tracking and analysis and more."
],
"metadata": {
"id": "L0q-knFpGUHN"
}
},
{
"cell_type": "markdown",
"source": [
"## Quickstart\n",
"\n",
"Since Portkey is fully compatible with the OpenAI signature, you can connect to the Portkey AI Gateway through OpenAI Client.\n",
"\n",
"- Set the `base_url` as `PORTKEY_GATEWAY_URL`\n",
"- Add `default_headers` to consume the headers needed by Portkey using the `createHeaders` helper method."
],
"metadata": {
"id": "tRvjIw-cGbef"
}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "fffx7Tc2ghTR",
"outputId": "b832e334-9770-4c7c-f7ea-dcba522986e8"
},
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/60.7 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[91m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m\u001b[91m╸\u001b[0m\u001b[90m━━━━━━\u001b[0m \u001b[32m51.2/60.7 kB\u001b[0m \u001b[31m1.9 MB/s\u001b[0m eta \u001b[36m0:00:01\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m60.7/60.7 kB\u001b[0m \u001b[31m1.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m262.9/262.9 kB\u001b[0m \u001b[31m11.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.6/75.6 kB\u001b[0m \u001b[31m5.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m12.5/12.5 MB\u001b[0m \u001b[31m54.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.7/1.7 MB\u001b[0m \u001b[31m53.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m77.9/77.9 kB\u001b[0m \u001b[31m6.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m5.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h"
]
}
],
"source": [
"!pip install -qU portkey-ai openai"
]
},
{
"cell_type": "code",
"source": [
"from openai import OpenAI\n",
"from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders\n",
"from google.colab import userdata"
],
"metadata": {
"id": "QNRIgaAIk--q"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## OpenAI"
],
"metadata": {
"id": "ptP4L78HlBUL"
}
},
{
"cell_type": "code",
"source": [
"client = OpenAI(\n",
" api_key=OPENAI_API_KEY,\n",
" base_url=PORTKEY_GATEWAY_URL,\n",
" default_headers=createHeaders(\n",
" provider=\"openai\",\n",
" api_key=PORTKEY_API_KEY\n",
" )\n",
")\n",
"\n",
"chat_complete = client.chat.completions.create(\n",
" model=\"gpt-4\",\n",
" messages=[{\"role\": \"user\",\n",
" \"content\": \"What's a fractal?\"}],\n",
")\n",
"\n",
"print(chat_complete.choices[0].message.content)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "I5YTh44Pgpqa",
"outputId": "1c763257-41ef-455a-fec6-2d9883316585"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"A fractal is a complex geometric shape that can be split into parts, each of which is a reduced-scale copy of the whole. Fractals are typically self-similar and independent of scale, meaning they look similar at any zoom level. They often appear in nature, in things like snowflakes, coastlines, and fern leaves. The term \"fractal\" was coined by mathematician Benoit Mandelbrot in 1975.\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"## Anthropic"
],
"metadata": {
"id": "FHTGygDilMGk"
}
},
{
"cell_type": "code",
"source": [
"from openai import OpenAI\n",
"from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders\n",
"\n",
"client = OpenAI(\n",
" api_key=userdata.get('ANTHROPIC_API_KEY')\n",
" base_url=PORTKEY_GATEWAY_URL,\n",
" default_headers=createHeaders(\n",
" provider=\"anthropic\",\n",
" api_key=PORTKEY_API_KEY\n",
" ),\n",
")\n",
"\n",
"response = client.chat.completions.create(\n",
" model=\"claude-3-opus-20240229\",\n",
" messages=[{\"role\": \"user\",\n",
" \"content\": \"What's a fractal?\"}],\n",
" max_tokens= 512\n",
")"
],
"metadata": {
"id": "5UaGvjbwYmj6"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"source": [
"## Mistral AI"
],
"metadata": {
"id": "6hGepv90lP5T"
}
},
{
"cell_type": "code",
"source": [
"from openai import OpenAI\n",
"from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders\n",
"\n",
"client = OpenAI(\n",
" api_key=userdata.get('MISTRAL_API_KEY'),\n",
" base_url=PORTKEY_GATEWAY_URL,\n",
" default_headers=createHeaders(\n",
" provider=\"mistral-ai\",\n",
" api_key=PORTKEY_API_KEY\n",
" )\n",
")\n",
"\n",
"chat_complete = client.chat.completions.create(\n",
" model=\"mistral-medium\",\n",
" messages=[{\"role\": \"user\",\n",
" \"content\": \"What's a fractal?\"}],\n",
")\n",
"\n",
"print(chat_complete.choices[0].message.content)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "ByWFpbVfW7Po",
"outputId": "b6274daf-0662-4e5c-808c-a239a653da8e"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"A fractal is a geometric shape or pattern that exhibits self-similarity at different scales. This means that the shape appears similar or identical when viewed at different levels of magnification. Fractals are often complex and intricate, and they can be generated mathematically using iterative algorithms. They are commonly found in nature, such as in the branching patterns of trees and the shapes of coastlines. Fractals have applications in various fields, including mathematics, physics, and computer graphics. Some famous examples of fractals include the Mandelbrot set and the Sierpinski triangle.\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"## Together AI"
],
"metadata": {
"id": "7o9Otqq2lSf8"
}
},
{
"cell_type": "code",
"source": [
"from openai import OpenAI\n",
"from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders\n",
"\n",
"client = OpenAI(\n",
" api_key=userdata.get('TOGETHER_API_KEY'),\n",
" base_url=PORTKEY_GATEWAY_URL,\n",
" default_headers=createHeaders(\n",
" provider=\"together-ai\",\n",
" api_key=PORTKEY_API_KEY\n",
" )\n",
")\n",
"\n",
"chat_complete = client.chat.completions.create(\n",
" model=\"meta-llama/Llama-2-70b-hf\",\n",
" messages=[{\"role\": \"user\",\n",
" \"content\": \"What's a fractal?\"}],\n",
")\n",
"\n",
"print(chat_complete.choices[0].message.content)"
],
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Yz7e9rokcCj0",
"outputId": "4305bf47-2c16-43c1-c1d4-40da7ce08e55"
},
"execution_count": null,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"<|im_start|>user\n",
"A fractal is a never ending pattern. Fractals are infinitely complex patterns that are self-similar across different scales. They are created by repeating a simple process over and over in an ongoing feedback loop. Driven by recursion, fractals are images of dynamic systems – the pictures of Chaos. Geometrically, they exist in between our familiar dimensions. Fractal patterns are extremely familiar, since nature is full of fractals. For instance: trees, rivers, coastlines, mountains, clouds, seashells, hurricanes, etc\n"
]
}
]
},
{
"cell_type": "markdown",
"source": [
"## Refer to our docs to integrate with other providers. [link](https://portkey.ai/docs/welcome/integration-guides)"
],
"metadata": {
"id": "doLNNsZyuEa6"
}
}
]
}
================================================
FILE: cookbook/getting-started/image-generation.ipynb
================================================
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "view-in-github"
},
"source": [
"<a href=\"https://colab.research.google.com/github/Portkey-AI/portkey-cookbook/blob/main/examples/image-generation.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"id": "3f6bb0eb-c5ef-4dd2-8fe9-1fecb492ae26",
"metadata": {
"id": "3f6bb0eb-c5ef-4dd2-8fe9-1fecb492ae26"
},
"source": [
"# Image Generation using the Portkey AI Gateway\n",
"\n",
"[Portkey's AI gateway](https://github.com/Portkey-AI/gateway) supports making calls to multiple Image models to generate images through a unified API. This notebook showcases the following functionality:\n",
"\n",
"1. Generating an image through OpenAI\n",
"2. Use the same request to generate an image using Stability AI\n",
"3. Setup a load balance between OpenAI and Stability, with a fallback to OpenAI's dall-e-2\n",
"4. Cache image requests for super fast loading\n",
"\n",
"This notebook uses the OpenAI SDK to showcase the functionality. We're using the hosted AI gateway on portkey.ai, but you could swap it for an internally hosted gateway as well."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0c613950-7606-40dd-a1d0-05b4cf3ba08d",
"metadata": {
"id": "0c613950-7606-40dd-a1d0-05b4cf3ba08d"
},
"outputs": [],
"source": [
"# Constants for use later - Please enter your own\n",
"PORTKEY_API_KEY=\"\" # Get this from your Portkey Account\n",
"OPENAI_API_KEY = \"\" # Your OpenAI key here\n",
"STABILITY_API_KEY = \"\" # Add your stability ai API key"
]
},
{
"cell_type": "markdown",
"id": "195ddea2-ea2b-4414-9e24-a4495636e7fb",
"metadata": {
"id": "195ddea2-ea2b-4414-9e24-a4495636e7fb"
},
"source": [
"### 1. Generate an image using OpenAI\n",
"\n",
"Let's try to make an image generation request to OpenAI through Portkey."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "12fb6747-da66-49b5-be3b-e72c324a74be",
"metadata": {
"id": "12fb6747-da66-49b5-be3b-e72c324a74be",
"outputId": "5ed455e1-9c04-4ea0-dc43-e6be75f0a57d"
},
"outputs": [
{
"data": {
"text/html": [
"<img src=\"https://oaidalleapiprodscus.blob.core.windows.net/private/org-MoQxcZmsvbzVKibXlRMuAHXm/user-i6swNsHjkKq4a2nVMPjXIzEj/img-5Tu0qUqrQzWieLdgVfvsqBGE.png?st=2024-02-21T08%3A42%3A39Z&se=2024-02-21T10%3A42%3A39Z&sp=r&sv=2021-08-06&sr=b&rscd=inline&rsct=image/png&skoid=6aaadede-4fb3-4698-a8f6-684d7786b067&sktid=a48cca56-e6da-484e-a814-9c849652bcb3&skt=2024-02-21T07%3A06%3A59Z&ske=2024-02-22T07%3A06%3A59Z&sks=b&skv=2021-08-06&sig=XZnNqgSMDtKOHq2xI/UobrPjCU6%2Bz6wXGSScrMQKfLc%3D\"/>"
],
"text/plain": [
"<IPython.core.display.Image object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from openai import OpenAI\n",
"from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders\n",
"from IPython.display import display, Image\n",
"\n",
"client = OpenAI(\n",
" api_key=OPENAI_API_KEY,\n",
" base_url=PORTKEY_GATEWAY_URL,\n",
" default_headers=createHeaders(\n",
" provider=\"openai\",\n",
" api_key=PORTKEY_API_KEY\n",
" )\n",
")\n",
"\n",
"image = client.images.generate(\n",
" model=\"dall-e-3\",\n",
" prompt=\"Lucy in the sky with diamonds\",\n",
" n=1,\n",
" size=\"1024x1024\"\n",
")\n",
"\n",
"# Display the image\n",
"display(Image(url=image.data[0].url))"
]
},
{
"cell_type": "markdown",
"id": "7e8c3885-314e-4d64-b758-4a0011a11267",
"metadata": {
"id": "7e8c3885-314e-4d64-b758-4a0011a11267"
},
"source": [
"This request went through Portkey's fast AI gateway which also then captures the information about the request on your Portkey Dashboard. On your logs screen, you'd be able to see this request like this\n",
"\n",
"<img src=\"attachment:34be4d67-09c5-4db0-bdfc-7b144f09ca15.png\" style=\"max-height: 400px;\"/>"
]
},
{
"cell_type": "markdown",
"id": "8c259350-1a18-49a9-8451-49978f8b5cc2",
"metadata": {
"id": "8c259350-1a18-49a9-8451-49978f8b5cc2"
},
"source": [
"### 2. Generate an image using Stability AI\n",
"Let's try to make an image generation request to Stability through Portkey. Notice that we're going to use the OpenAI SDK itself to make calls to Stability AI as well"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b49a7dfc-b08f-4e0d-878b-b2aa6b6fd2a6",
"metadata": {
"id": "b49a7dfc-b08f-4e0d-878b-b2aa6b6fd2a6",
"outputId": "6074fbde-bfc7-4520-a61c-ff3514b982fc"
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAUAAAAFACAIAAABC8jL9AACaL2NhQlgAAJovanVtYgAAAB5qdW1kYzJwYQARABCAAACqADibcQNjMnBhAAAAmglqdW1iAAAAR2p1bWRjMm1hABEAEIAAAKoAOJtxA3Vybjp1dWlkOmNlM2IxOGZkLTFkZGUtNDE0OS04NjQzLTg1NTFmZmViMzM2NwAAAFthanVtYgAAAClqdW1kYzJhcwARABCAAACqADibcQNjMnBhLmFzc2VydGlvbnMAAABZA2p1bWIAAAAzanVtZEDLDDK7ikidpwsq1vR/Q2kDYzJwYS50aHVtYm5haWwuY2xhaW0uanBlZwAAAAAUYmZkYgBpbWFnZS9qcGVnAAAAWLRiaWRi/9j/4AAQSkZJRgABAgAAAQABAAD/wAARCAFAAUADAREAAhEBAxEB/9sAQwAGBAUGBQQGBgUGBwcGCAoQCgoJCQoUDg8MEBcUGBgXFBYWGh0lHxobIxwWFiAsICMmJykqKRkfLTAtKDAlKCko/9sAQwEHBwcKCAoTCgoTKBoWGig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JMCMZSUgGdEhCMsxIhhkkoAMKdCAB+0BJ1iEJyTqACWJgRjIzAf45JnSAA1gkmQkd4D9DjH3AP0UyEwAxOiTbB3TMbJ9ZNLN9JgD/5cTYB3RMAA6QTIF/LxM6gJmYmZl0ADOBRHIkMxOTqdGilWljgomaYKImgJqrTBvARA01URPMHMyhBUBJBgqYqOWXyK4CoICJAqBmZgJaoY0JJmqCiZJfIrsKgAIkIRlJYA41AGqCiZpgJmYGajI1apKBAqDkl8iuAqCAiZpgopZfsvyqCSZqgomaAIpWSGOCiZpgoiaYqLnKtDEBFAAFwAPgaRc6gImaYHgTTNQE8AB42gWaJbRCAiCmACgACnTILpFdBUzUBBM1V5k2JoBiSnJmYqIAKKagmJqohQVrF8gvkV3FFBRTUAAU6JBfIruKKSimJAeQBObQkoTkzITk8JdxVwBQABQAJbtk+VVMQQETNcFEzVWmDQBqgokCoJZfsvyqCSZqqIkCoGSXyK6KAQqAAqDklyy/
gitextract__7o1qj1m/ ├── .dockerignore ├── .git-blame-ignore-revs ├── .gitattributes ├── .github/ │ ├── CODE_OF_CONDUCT.md │ ├── CONTRIBUTING.cn.md │ ├── CONTRIBUTING.md │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.yml │ │ ├── config.yml │ │ └── feature_request.yml │ ├── README.cn.md │ ├── README.jp.md │ ├── SECURITY.md │ ├── SUPPORT.md │ ├── cn.CODE_OF_CONDUCT.md │ ├── pull_request_template.md │ └── workflows/ │ ├── check_code_formatting.yml │ ├── docker_publish.yml │ ├── link-checker.yml │ ├── npm_publish.yml │ ├── run_tests.yml │ └── triage-label.yml ├── .gitignore ├── .husky/ │ ├── pre-commit │ └── pre-push ├── .prettierignore ├── .prettierrc ├── .vscode/ │ ├── launch.json │ └── tasks.json ├── CLAUDE.md ├── Dockerfile ├── LICENSE ├── README.md ├── conf.example.json ├── cookbook/ │ ├── README.md │ ├── getting-started/ │ │ ├── automatic-retries-on-failures.md │ │ ├── enable-cache.md │ │ ├── fallback-from-openai-to-azure.ipynb │ │ ├── fallback-from-stable-diffusion-to-dall-e.ipynb │ │ ├── gentle-introduction-to-portkey-gateway.ipynb │ │ ├── image-generation.ipynb │ │ ├── resilient-loadbalancing-with-failure-mitigating-fallbacks.md │ │ └── writing-your-first-gateway-config.md │ ├── guardrails/ │ │ └── Langchain Chatbot with PII Guardrails.ipynb │ ├── integrations/ │ │ ├── Instructor_with_Portkey.ipynb │ │ ├── Mistral.ipynb │ │ ├── Phidata_with_ Perplexity.ipynb │ │ ├── Phidata_with_Portkey.ipynb │ │ ├── ReAct Agents Portkey.ipynb │ │ ├── Sutra_with_Portkey.ipynb │ │ ├── Tool_Use_with_Portkey.ipynb │ │ ├── anyscale.md │ │ ├── deepinfra.ipynb │ │ ├── groq.ipynb │ │ ├── langchain.ipynb │ │ ├── mistral.md │ │ ├── mixtral-8x22b.ipynb │ │ ├── ncompass.ipynb │ │ ├── openai.ipynb │ │ ├── segmind.ipynb │ │ ├── vercel/ │ │ │ ├── app/ │ │ │ │ ├── api/ │ │ │ │ │ └── chat/ │ │ │ │ │ └── route.ts │ │ │ │ ├── examples/ │ │ │ │ │ ├── basic-chatbot/ │ │ │ │ │ │ └── page.tsx │ │ │ │ │ ├── generate-text/ │ │ │ │ │ │ ├── action.ts │ │ │ │ │ │ ├── conditional-routing.ts │ │ │ │ │ │ ├── fallback.ts │ │ │ │ │ │ ├── guardrails.ts │ │ │ │ │ │ ├── load-balance.ts │ │ │ │ │ │ └── page.tsx │ │ │ │ │ ├── generate-ui-streamui/ │ │ │ │ │ │ ├── action.tsx │ │ │ │ │ │ ├── joke-component.tsx │ │ │ │ │ │ ├── joke.ts │ │ │ │ │ │ └── page.tsx │ │ │ │ │ ├── layout.tsx │ │ │ │ │ ├── stream-text/ │ │ │ │ │ │ ├── action.ts │ │ │ │ │ │ └── page.tsx │ │ │ │ │ └── tools/ │ │ │ │ │ └── basic/ │ │ │ │ │ ├── action.ts │ │ │ │ │ └── page.tsx │ │ │ │ ├── globals.css │ │ │ │ ├── layout.tsx │ │ │ │ └── page.tsx │ │ │ ├── components/ │ │ │ │ ├── back-button.tsx │ │ │ │ ├── link.tsx │ │ │ │ └── ui/ │ │ │ │ ├── button.tsx │ │ │ │ ├── card.tsx │ │ │ │ ├── input.tsx │ │ │ │ └── label.tsx │ │ │ ├── components.json │ │ │ ├── core/ │ │ │ │ ├── generate-text.ts │ │ │ │ ├── stream-text.ts │ │ │ │ └── tools.ts │ │ │ ├── lib/ │ │ │ │ └── utils.ts │ │ │ ├── next-env.d.ts │ │ │ ├── next.config.mjs │ │ │ ├── package.json │ │ │ ├── postcss.config.js │ │ │ ├── readme.md │ │ │ ├── tailwind.config.ts │ │ │ └── tsconfig.json │ │ └── vercel-ai.md │ ├── monitoring-agents/ │ │ ├── Autogen_with_Telemetry.ipynb │ │ ├── ControlFlow_with_Telemetry.ipynb │ │ ├── CrewAI_with_Telemetry.ipynb │ │ └── Llama_Agents_with_Telemetry.ipynb │ ├── providers/ │ │ ├── aibadgr.ipynb │ │ ├── anthropic.ipynb │ │ ├── deepinfra.ipynb │ │ ├── groq.ipynb │ │ ├── mistral.ipynb │ │ ├── ncompass.ipynb │ │ ├── nvidia.ipynb │ │ ├── openai.ipynb │ │ ├── segmind.ipynb │ │ └── together.ipynb │ └── use-cases/ │ ├── Claude_3_5_Sonnet_vs_GPT_4o_Portkey.ipynb │ ├── Claude_3_5_Sonnet_with_Portkey.ipynb │ ├── Contextual Embeddings Guide Anthropic, Cohere, Voyage.ipynb │ ├── Creating_Artifacts_with_GPT_4o_.ipynb │ ├── GPT-4o & Portkey/ │ │ ├── Audio Processing - GPT-4o & Portkey.ipynb │ │ ├── GPT-4o vs Claude-3-Opus vs Gemini-1.5-Pro - Portkey.ipynb │ │ ├── Image Processing - GPT-4o & Portkey.ipynb │ │ ├── Intro_to_GPT4o_Portkey.ipynb │ │ └── Video Processing - GPT-4o & Portkey.ipynb │ ├── LMSYS Series/ │ │ ├── Comparision_of_Top_6_LMSYS_Vison_models_using_Portkey.ipynb │ │ ├── README.md │ │ └── comparing-top10-LMSYS-models-with-Portkey.ipynb │ ├── Nemotron_GPT_Finetuning_Portkey.ipynb │ ├── Testing_Top_Vision_Models.ipynb │ ├── llama-3-on-groq.ipynb │ ├── run-gateway-on-prompts-from-langchain-hub.md │ ├── smart-fallback-with-model-optimized-prompts.md │ ├── supabase-pgvector-and-portkey.md │ └── use-openai-sdk-with-portkey-prompt-templates.md ├── deployment.yaml ├── docker-compose.yaml ├── docs/ │ ├── deploy-on-replit.md │ └── installation-deployments.md ├── eslint.config.js ├── initializeSettings.ts ├── jest.config.js ├── package.json ├── patches/ │ ├── @types+async-retry+1.4.5.patch │ └── async-retry+1.3.3.patch ├── plugins/ │ ├── Contributing.md │ ├── README.md │ ├── acuvity/ │ │ ├── helper.test.ts │ │ ├── helper.ts │ │ ├── manifest.json │ │ ├── model.ts │ │ ├── scan.test.ts │ │ └── scan.ts │ ├── aporia/ │ │ ├── aporia.test.ts │ │ ├── manifest.json │ │ └── validateProject.ts │ ├── azure/ │ │ ├── azure.test.ts │ │ ├── contentSafety.ts │ │ ├── manifest.json │ │ ├── pii.ts │ │ ├── protectedMaterial.ts │ │ ├── shieldPrompt.ts │ │ ├── types.ts │ │ └── utils.ts │ ├── bedrock/ │ │ ├── bedrock.test.ts │ │ ├── index.ts │ │ ├── manifest.json │ │ ├── type.ts │ │ └── util.ts │ ├── build.ts │ ├── crowdstrike-aidr/ │ │ ├── aidr.test.ts │ │ ├── guardChatCompletion.ts │ │ ├── manifest.json │ │ └── version.ts │ ├── default/ │ │ ├── addPrefix.ts │ │ ├── alllowercase.ts │ │ ├── allowedRequestTypes.ts │ │ ├── alluppercase.ts │ │ ├── characterCount.ts │ │ ├── contains.ts │ │ ├── containsCode.ts │ │ ├── default.test.ts │ │ ├── endsWith.ts │ │ ├── jsonKeys.ts │ │ ├── jsonSchema.ts │ │ ├── jwt.ts │ │ ├── log.ts │ │ ├── manifest.json │ │ ├── modelRules.ts │ │ ├── modelWhitelist.ts │ │ ├── notNull.ts │ │ ├── regexMatch.ts │ │ ├── regexReplace.ts │ │ ├── requiredMetadataKeys.ts │ │ ├── sentenceCount.ts │ │ ├── validUrls.ts │ │ ├── webhook.ts │ │ └── wordCount.ts │ ├── exa/ │ │ ├── exa.test.ts │ │ ├── manifest.json │ │ └── online.ts │ ├── f5-guardrails/ │ │ ├── manifest.json │ │ ├── scan.test.ts │ │ └── scan.ts │ ├── index.ts │ ├── javelin/ │ │ ├── guardrails.ts │ │ ├── javelin.test.ts │ │ └── manifest.json │ ├── lasso/ │ │ ├── README.md │ │ ├── classify.ts │ │ ├── lasso.test.ts │ │ └── manifest.json │ ├── mistral/ │ │ ├── index.ts │ │ ├── manifest.json │ │ └── mistral.test.ts │ ├── pangea/ │ │ ├── manifest.json │ │ ├── pangea.test.ts │ │ ├── pii.ts │ │ ├── textGuard.ts │ │ └── version.ts │ ├── panw-prisma-airs/ │ │ ├── intercept.ts │ │ ├── manifest.json │ │ └── panw.airs.test.ts │ ├── patronus/ │ │ ├── custom.ts │ │ ├── globals.ts │ │ ├── isConcise.ts │ │ ├── isHelpful.ts │ │ ├── isPolite.ts │ │ ├── manifest.json │ │ ├── noApologies.ts │ │ ├── noGenderBias.ts │ │ ├── noRacialBias.ts │ │ ├── patronus.test.ts │ │ ├── phi.ts │ │ ├── pii.ts │ │ ├── retrievalAnswerRelevance.ts │ │ ├── retrievalHallucination.ts │ │ └── toxicity.ts │ ├── pillar/ │ │ ├── globals.ts │ │ ├── manifest.json │ │ ├── pillar.test.ts │ │ ├── scanPrompt.ts │ │ └── scanResponse.ts │ ├── portkey/ │ │ ├── gibberish.ts │ │ ├── globals.ts │ │ ├── language.ts │ │ ├── manifest.json │ │ ├── moderateContent.ts │ │ ├── pii.ts │ │ └── portkey.test.ts │ ├── promptfoo/ │ │ ├── globals.ts │ │ ├── guard.ts │ │ ├── harm.ts │ │ ├── manifest.json │ │ ├── pii.ts │ │ ├── promptfoo.test.ts │ │ └── types.ts │ ├── promptsecurity/ │ │ ├── manifest.json │ │ ├── promptsecurity.test.ts │ │ ├── protectPrompt.ts │ │ ├── protectResponse.ts │ │ └── shared.ts │ ├── qualifire/ │ │ ├── contentModeration.ts │ │ ├── globals.ts │ │ ├── grounding.ts │ │ ├── hallucinations.ts │ │ ├── manifest.json │ │ ├── pii.ts │ │ ├── policy.ts │ │ ├── promptInjections.ts │ │ ├── qualifire.test.ts │ │ └── toolUseQuality.ts │ ├── sydelabs/ │ │ ├── manifest.json │ │ ├── sydeguard.ts │ │ └── sydelabs.test.ts │ ├── types.ts │ ├── utils.test.ts │ ├── utils.ts │ └── walledai/ │ ├── manifest.json │ ├── walledai.test.ts │ └── walledprotect.ts ├── rollup.config.js ├── src/ │ ├── apm/ │ │ └── index.ts │ ├── data/ │ │ ├── models.json │ │ └── providers.json │ ├── errors/ │ │ ├── GatewayError.ts │ │ └── RouterError.ts │ ├── globals.ts │ ├── handlers/ │ │ ├── batchesHandler.ts │ │ ├── chatCompletionsHandler.ts │ │ ├── completionsHandler.ts │ │ ├── createSpeechHandler.ts │ │ ├── createTranscriptionHandler.ts │ │ ├── createTranslationHandler.ts │ │ ├── embeddingsHandler.ts │ │ ├── filesHandler.ts │ │ ├── finetuneHandler.ts │ │ ├── handlerUtils.ts │ │ ├── imageEditsHandler.ts │ │ ├── imageGenerationsHandler.ts │ │ ├── messagesCountTokensHandler.ts │ │ ├── messagesHandler.ts │ │ ├── modelResponsesHandler.ts │ │ ├── modelsHandler.ts │ │ ├── proxyHandler.ts │ │ ├── realtimeHandler.ts │ │ ├── realtimeHandlerNode.ts │ │ ├── responseHandlers.ts │ │ ├── retryHandler.ts │ │ ├── services/ │ │ │ ├── cacheService.ts │ │ │ ├── hooksService.ts │ │ │ ├── logsService.ts │ │ │ ├── preRequestValidatorService.ts │ │ │ ├── providerContext.ts │ │ │ ├── requestContext.ts │ │ │ └── responseService.ts │ │ ├── streamHandler.ts │ │ ├── streamHandlerUtils.ts │ │ └── websocketUtils.ts │ ├── index.ts │ ├── middlewares/ │ │ ├── cache/ │ │ │ └── index.ts │ │ ├── hooks/ │ │ │ ├── globals.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── log/ │ │ │ └── index.ts │ │ └── requestValidator/ │ │ ├── index.ts │ │ └── schema/ │ │ └── config.ts │ ├── providers/ │ │ ├── 302ai/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── ai21/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── embed.ts │ │ │ └── index.ts │ │ ├── aibadgr/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── anthropic/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── index.ts │ │ │ ├── messages.ts │ │ │ ├── types.ts │ │ │ └── utils.ts │ │ ├── anthropic-base/ │ │ │ ├── constants.ts │ │ │ ├── messages.ts │ │ │ ├── types.ts │ │ │ └── utils/ │ │ │ └── streamGenerator.ts │ │ ├── anyscale/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── embed.ts │ │ │ └── index.ts │ │ ├── azure-ai-inference/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── embed.ts │ │ │ ├── getBatchOutput.ts │ │ │ ├── index.ts │ │ │ ├── messages.ts │ │ │ └── utils.ts │ │ ├── azure-openai/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── createBatch.ts │ │ │ ├── createFinetune.ts │ │ │ ├── createSpeech.ts │ │ │ ├── createTranscription.ts │ │ │ ├── createTranslation.ts │ │ │ ├── embed.ts │ │ │ ├── getBatchOutput.ts │ │ │ ├── imageGenerate.ts │ │ │ ├── index.ts │ │ │ └── utils.ts │ │ ├── bedrock/ │ │ │ ├── api.ts │ │ │ ├── cancelBatch.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── constants.ts │ │ │ ├── countTokens.ts │ │ │ ├── createBatch.ts │ │ │ ├── createFinetune.ts │ │ │ ├── deleteFile.ts │ │ │ ├── embed.ts │ │ │ ├── getBatchOutput.ts │ │ │ ├── imageGenerate.ts │ │ │ ├── index.ts │ │ │ ├── listBatches.ts │ │ │ ├── listFinetunes.ts │ │ │ ├── listfiles.ts │ │ │ ├── messages.ts │ │ │ ├── retrieveBatch.ts │ │ │ ├── retrieveFile.ts │ │ │ ├── retrieveFileContent.ts │ │ │ ├── retrieveFinetune.ts │ │ │ ├── types.ts │ │ │ ├── uploadFile.ts │ │ │ ├── uploadFileUtils.ts │ │ │ ├── utils/ │ │ │ │ └── messagesUtils.ts │ │ │ └── utils.ts │ │ ├── bytez/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── cerebras/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── cohere/ │ │ │ ├── api.ts │ │ │ ├── cancelBatch.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── createBatch.ts │ │ │ ├── deleteFile.ts │ │ │ ├── embed.ts │ │ │ ├── getBatchOutput.ts │ │ │ ├── getFiles.ts │ │ │ ├── index.ts │ │ │ ├── listBatches.ts │ │ │ ├── retrieveBatch.ts │ │ │ ├── types.ts │ │ │ ├── uploadFile.ts │ │ │ └── utils.ts │ │ ├── cometapi/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── embed.ts │ │ │ └── index.ts │ │ ├── cortex/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── dashscope/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── deepbricks/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── imageGenerate.ts │ │ │ └── index.ts │ │ ├── deepinfra/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── deepseek/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── featherless-ai/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── fireworks-ai/ │ │ │ ├── api.ts │ │ │ ├── cancelFinetune.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── createFinetune.ts │ │ │ ├── embed.ts │ │ │ ├── imageGenerate.ts │ │ │ ├── index.ts │ │ │ ├── listFiles.ts │ │ │ ├── listFinetune.ts │ │ │ ├── retrieveFile.ts │ │ │ ├── types.ts │ │ │ ├── uploadFile.ts │ │ │ └── utils.ts │ │ ├── google/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── embed.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── google-vertex-ai/ │ │ │ ├── api.ts │ │ │ ├── cancelBatch.ts │ │ │ ├── chatComplete.ts │ │ │ ├── createBatch.ts │ │ │ ├── createFinetune.ts │ │ │ ├── embed.ts │ │ │ ├── getBatchOutput.ts │ │ │ ├── imageGenerate.ts │ │ │ ├── index.ts │ │ │ ├── listBatches.ts │ │ │ ├── listFiles.ts │ │ │ ├── listFinetunes.ts │ │ │ ├── messages.ts │ │ │ ├── messagesCountTokens.ts │ │ │ ├── retrieveBatch.ts │ │ │ ├── retrieveFile.ts │ │ │ ├── retrieveFileContent.ts │ │ │ ├── retrieveFinetune.ts │ │ │ ├── transformGenerationConfig.ts │ │ │ ├── types.ts │ │ │ ├── uploadFile.ts │ │ │ ├── utils.test.ts │ │ │ └── utils.ts │ │ ├── groq/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── huggingface/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ └── utils.ts │ │ ├── hyperbolic/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── imageGenerate.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── inference-net/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── iointelligence/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── jina/ │ │ │ ├── api.ts │ │ │ ├── embed.ts │ │ │ └── index.ts │ │ ├── kluster-ai/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── index.ts │ │ │ └── uploadFile.ts │ │ ├── krutrim/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── lambda/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── lemonfox-ai/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── createTranscription.ts │ │ │ ├── imageGenerate.ts │ │ │ └── index.ts │ │ ├── lepton/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── createTranscription.ts │ │ │ └── index.ts │ │ ├── lingyi/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── matterai/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── meshy/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── milvus/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── mistral-ai/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── embed.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── modal/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── monsterapi/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── moonshot/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── ncompass/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── nebius/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── nextbit/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── nomic/ │ │ │ ├── api.ts │ │ │ ├── embed.ts │ │ │ └── index.ts │ │ ├── novita-ai/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ └── index.ts │ │ ├── nscale/ │ │ │ ├── api.ts │ │ │ ├── imageGenerate.ts │ │ │ └── index.ts │ │ ├── ollama/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── embed.ts │ │ │ └── index.ts │ │ ├── open-ai-base/ │ │ │ ├── constants.ts │ │ │ ├── createModelResponse.ts │ │ │ ├── helpers.ts │ │ │ └── index.ts │ │ ├── openai/ │ │ │ ├── api.ts │ │ │ ├── cancelBatch.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── createBatch.ts │ │ │ ├── createFinetune.ts │ │ │ ├── createSpeech.ts │ │ │ ├── createTranscription.ts │ │ │ ├── createTranslation.ts │ │ │ ├── deleteFile.ts │ │ │ ├── embed.ts │ │ │ ├── getBatchOutput.ts │ │ │ ├── imageGenerate.ts │ │ │ ├── index.ts │ │ │ ├── listBatches.ts │ │ │ ├── listFiles.ts │ │ │ ├── retrieveBatch.ts │ │ │ ├── retrieveFileContent.ts │ │ │ ├── uploadFile.ts │ │ │ └── utils.ts │ │ ├── openrouter/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── index.ts │ │ │ └── utils.ts │ │ ├── oracle/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── index.ts │ │ │ ├── types/ │ │ │ │ ├── ChatDetails.ts │ │ │ │ └── GenericChatResponse.ts │ │ │ └── utils.ts │ │ ├── ovhcloud/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── palm/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── embed.ts │ │ │ └── index.ts │ │ ├── perplexity-ai/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── predibase/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── qdrant/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── recraft-ai/ │ │ │ ├── api.ts │ │ │ ├── imageGenerate.ts │ │ │ ├── index.ts │ │ │ └── utils.ts │ │ ├── reka-ai/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── replicate/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── sagemaker/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── sambanova/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ └── index.ts │ │ ├── segmind/ │ │ │ ├── api.ts │ │ │ ├── imageGenerate.ts │ │ │ └── index.ts │ │ ├── siliconflow/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── embed.ts │ │ │ ├── imageGenerate.ts │ │ │ └── index.ts │ │ ├── stability-ai/ │ │ │ ├── api.ts │ │ │ ├── constants.ts │ │ │ ├── imageGenerate.ts │ │ │ ├── imageGenerateV2.ts │ │ │ ├── index.ts │ │ │ └── utils.ts │ │ ├── together-ai/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── embed.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── tripo3d/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── triton/ │ │ │ ├── api.ts │ │ │ ├── complete.ts │ │ │ └── index.ts │ │ ├── types.ts │ │ ├── upstage/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── utils/ │ │ │ └── finishReasonMap.ts │ │ ├── utils.ts │ │ ├── voyage/ │ │ │ ├── api.ts │ │ │ ├── embed.ts │ │ │ └── index.ts │ │ ├── workers-ai/ │ │ │ ├── api.ts │ │ │ ├── chatComplete.ts │ │ │ ├── complete.ts │ │ │ ├── embed.ts │ │ │ ├── imageGenerate.ts │ │ │ ├── index.ts │ │ │ └── utils.ts │ │ ├── x-ai/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ ├── z-ai/ │ │ │ ├── api.ts │ │ │ └── index.ts │ │ └── zhipu/ │ │ ├── api.ts │ │ ├── chatComplete.ts │ │ ├── embed.ts │ │ └── index.ts │ ├── public/ │ │ └── index.html │ ├── services/ │ │ ├── conditionalRouter.ts │ │ ├── realtimeLlmEventParser.ts │ │ └── transformToProviderRequest.ts │ ├── shared/ │ │ ├── services/ │ │ │ └── cache/ │ │ │ ├── backends/ │ │ │ │ ├── cloudflareKV.ts │ │ │ │ ├── file.ts │ │ │ │ ├── memory.ts │ │ │ │ └── redis.ts │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ └── utils/ │ │ │ └── rateLimiter.ts │ │ └── utils/ │ │ └── logger.ts │ ├── start-server.ts │ ├── tests/ │ │ ├── common.test.ts │ │ ├── resources/ │ │ │ ├── constants.ts │ │ │ ├── requestTemplates.ts │ │ │ ├── testVariables.ts │ │ │ └── utils.ts │ │ └── routeSpecificTestFunctions.ts/ │ │ └── chatCompletion.ts │ ├── types/ │ │ ├── MessagesRequest.ts │ │ ├── MessagesStreamResponse.ts │ │ ├── embedRequestBody.ts │ │ ├── inputList.ts │ │ ├── messagesResponse.ts │ │ ├── modelResponses.ts │ │ ├── requestBody.ts │ │ ├── responseBody.ts │ │ └── shared.ts │ ├── utils/ │ │ ├── CryptoUtils.ts │ │ ├── env.ts │ │ └── misc.ts │ └── utils.ts ├── start-test.js ├── tests/ │ ├── integration/ │ │ └── src/ │ │ └── handlers/ │ │ ├── .creds.example.json │ │ ├── requestBuilder.ts │ │ ├── test.txt │ │ └── tryPost.test.ts │ └── unit/ │ └── src/ │ └── handlers/ │ └── services/ │ ├── benchmark.ts │ ├── cacheService.test.ts │ ├── hooksService.test.ts │ ├── logsService.test.ts │ ├── preRequestValidatorService.test.ts │ ├── providerContext.test.ts │ ├── requestContext.test.ts │ └── responseService.test.ts ├── tsconfig.json └── wrangler.toml
SYMBOL INDEX (1459 symbols across 282 files)
FILE: cookbook/integrations/vercel/app/api/chat/route.ts
function POST (line 4) | async function POST(request: Request) {
FILE: cookbook/integrations/vercel/app/examples/basic-chatbot/page.tsx
function Chat (line 5) | function Chat() {
FILE: cookbook/integrations/vercel/app/examples/generate-text/page.tsx
function Page (line 7) | function Page() {
FILE: cookbook/integrations/vercel/app/examples/generate-ui-streamui/action.tsx
type ServerMessage (line 12) | interface ServerMessage {
type ClientMessage (line 17) | interface ClientMessage {
function continueConversation (line 23) | async function continueConversation(
FILE: cookbook/integrations/vercel/app/examples/generate-ui-streamui/joke.ts
type Joke (line 9) | type Joke = DeepPartial<typeof jokeSchema>;
FILE: cookbook/integrations/vercel/app/examples/generate-ui-streamui/page.tsx
function Home (line 8) | function Home() {
FILE: cookbook/integrations/vercel/app/examples/layout.tsx
function Layout (line 1) | function Layout({ children }: { children: React.ReactNode }) {
FILE: cookbook/integrations/vercel/app/examples/stream-text/page.tsx
function Page (line 8) | function Page() {
FILE: cookbook/integrations/vercel/app/examples/tools/basic/page.tsx
function Page (line 9) | function Page() {
FILE: cookbook/integrations/vercel/app/layout.tsx
function RootLayout (line 14) | function RootLayout({
FILE: cookbook/integrations/vercel/app/page.tsx
function Page (line 3) | function Page() {
FILE: cookbook/integrations/vercel/components/ui/button.tsx
type ButtonProps (line 36) | interface ButtonProps
FILE: cookbook/integrations/vercel/components/ui/input.tsx
type InputProps (line 5) | interface InputProps
FILE: cookbook/integrations/vercel/core/generate-text.ts
function main (line 7) | async function main() {
FILE: cookbook/integrations/vercel/core/stream-text.ts
function main (line 7) | async function main() {
FILE: cookbook/integrations/vercel/core/tools.ts
function main (line 8) | async function main() {
FILE: cookbook/integrations/vercel/lib/utils.ts
function cn (line 4) | function cn(...inputs: ClassValue[]) {
FILE: plugins/acuvity/helper.ts
type GuardResult (line 3) | interface GuardResult {
class GuardName (line 12) | class GuardName {
method constructor (line 13) | private constructor(private readonly name: string) {}
method toString (line 27) | public toString(): string {
method equals (line 31) | public equals(other: GuardName): boolean {
function decodeJwt (line 41) | function decodeJwt(token: string) {
function getApexUrlFromToken (line 62) | function getApexUrlFromToken(token: string): string | null {
class ResponseHelper (line 73) | class ResponseHelper {
method evaluate (line 83) | public evaluate(
method getGuardValue (line 166) | private getGuardValue(
method getTextDetections (line 179) | private getTextDetections(
FILE: plugins/acuvity/model.ts
type ClosedEnum (line 1) | type ClosedEnum<T> = T[keyof T];
type Modality (line 3) | type Modality = {
type TextualdetectionType (line 26) | type TextualdetectionType = ClosedEnum<typeof TextualdetectionType>;
type Textualdetection (line 31) | type Textualdetection = {
type Extraction (line 70) | type Extraction = {
FILE: plugins/acuvity/scan.test.ts
function getPromptInjectionParameters (line 7) | function getPromptInjectionParameters(): PluginParameters {
function getJailBreakParameters (line 15) | function getJailBreakParameters(): PluginParameters {
function getHarmfulParameters (line 23) | function getHarmfulParameters(): PluginParameters {
function getToxicityParameters (line 31) | function getToxicityParameters(): PluginParameters {
function getLanguageParameters (line 39) | function getLanguageParameters(): PluginParameters {
function getPIIParameters (line 47) | function getPIIParameters(): PluginParameters {
function getPIIRedactParameters (line 61) | function getPIIRedactParameters(): PluginParameters {
function getSecretsParameters (line 76) | function getSecretsParameters(): PluginParameters {
function getSecretsRedactedParameters (line 91) | function getSecretsRedactedParameters(): PluginParameters {
function getLangParameters (line 107) | function getLangParameters(): PluginParameters {
function getParameters (line 115) | function getParameters(): PluginParameters {
FILE: plugins/acuvity/scan.ts
type ScanRequest (line 15) | interface ScanRequest {
function evaluateAllParameters (line 190) | function evaluateAllParameters(
FILE: plugins/aporia/aporia.test.ts
function getParameters (line 4) | function getParameters() {
FILE: plugins/aporia/validateProject.ts
constant APORIA_BASE_URL (line 10) | const APORIA_BASE_URL = 'https://gr-prd.aporia.com';
FILE: plugins/azure/types.ts
type AzureCredentials (line 1) | interface AzureCredentials {
FILE: plugins/azure/utils.ts
function getAccessTokenFromEntraId (line 5) | async function getAccessTokenFromEntraId(
function getAzureManagedIdentityToken (line 59) | async function getAzureManagedIdentityToken(
FILE: plugins/bedrock/index.ts
constant REQUIRED_CREDENTIAL_KEYS (line 10) | const REQUIRED_CREDENTIAL_KEYS = [
FILE: plugins/bedrock/type.ts
type BedrockAccessKeyCreds (line 1) | type BedrockAccessKeyCreds = {
type BedrockAssumedRoleCreds (line 9) | type BedrockAssumedRoleCreds = {
type BedrockBody (line 16) | type BedrockBody = {
type PIIType (line 21) | type PIIType =
type BedrockAction (line 54) | interface BedrockAction<T = string> {
type ContentPolicy (line 58) | interface ContentPolicy extends BedrockAction {
type WordPolicy (line 70) | interface WordPolicy extends BedrockAction {
type PIIFilter (line 74) | interface PIIFilter<T = any> extends BedrockAction<T> {
type BedrockResponse (line 79) | interface BedrockResponse {
type BedrockParameters (line 105) | interface BedrockParameters {
FILE: plugins/bedrock/util.ts
function getAssumedRoleCredentials (line 144) | async function getAssumedRoleCredentials(
function parseXml (line 239) | function parseXml(xml: string) {
FILE: plugins/crowdstrike-aidr/guardChatCompletion.ts
function errorToString (line 141) | function errorToString(response: any): string {
FILE: plugins/crowdstrike-aidr/version.ts
constant VERSION (line 1) | const VERSION = 'v1.0.0-beta';
FILE: plugins/default/alllowercase.ts
function isAllLowerCase (line 9) | function isAllLowerCase(str: string): boolean {
FILE: plugins/default/alluppercase.ts
function isAllUpperCase (line 9) | function isAllUpperCase(str: string): boolean {
FILE: plugins/default/characterCount.ts
function countCharacters (line 9) | function countCharacters(text: string): number {
FILE: plugins/default/jsonKeys.ts
function extractJson (line 10) | function extractJson(text: string): string[] {
type BestMatch (line 69) | interface BestMatch {
function getExplanation (line 156) | function getExplanation(
FILE: plugins/default/jwt.ts
type JWKSCacheOptions (line 4) | interface JWKSCacheOptions {
function getMatchingKey (line 10) | async function getMatchingKey(token: string, jwks: any) {
function fetchAndCacheJWKS (line 20) | async function fetchAndCacheJWKS(
FILE: plugins/default/modelRules.ts
type RulesData (line 8) | interface RulesData {
type RulesShape (line 35) | type RulesShape = {
FILE: plugins/default/regexReplace.ts
function parseRegex (line 9) | function parseRegex(input: string): RegExp {
FILE: plugins/default/sentenceCount.ts
function countSentences (line 9) | function countSentences(text: string): number {
FILE: plugins/default/validUrls.ts
function checkUrl (line 111) | async function checkUrl(target: string): Promise<boolean> {
function checkDNS (line 147) | async function checkDNS(target: string): Promise<boolean> {
FILE: plugins/default/webhook.ts
function parseHeaders (line 9) | function parseHeaders(headers: unknown): Record<string, string> {
FILE: plugins/default/wordCount.ts
function countWords (line 9) | function countWords(text: string): number {
FILE: plugins/exa/online.ts
constant BASE_URL (line 9) | const BASE_URL = 'https://api.exa.ai/search';
type SearchResult (line 11) | interface SearchResult {
type ExaSearchResponse (line 19) | interface ExaSearchResponse {
FILE: plugins/f5-guardrails/scan.ts
type F5GuardrailsCredentials (line 14) | interface F5GuardrailsCredentials {
type F5GuardrailsResponse (line 20) | interface F5GuardrailsResponse {
FILE: plugins/javelin/guardrails.ts
type JavelinCredentials (line 9) | interface JavelinCredentials {
type GuardrailAssessment (line 15) | interface GuardrailAssessment {
type GuardrailsResponse (line 33) | interface GuardrailsResponse {
function callJavelinGuardrails (line 37) | async function callJavelinGuardrails(
FILE: plugins/lasso/classify.ts
constant LASSO_BASE_URL (line 10) | const LASSO_BASE_URL = 'https://server.lasso.security';
type LassoMessage (line 12) | interface LassoMessage {
type LassoClassifyRequest (line 17) | interface LassoClassifyRequest {
type LassoClassifyResponse (line 21) | interface LassoClassifyResponse {
FILE: plugins/lasso/lasso.test.ts
function getParameters (line 4) | function getParameters() {
FILE: plugins/mistral/index.ts
type MistralResponse (line 9) | interface MistralResponse {
type GuardrailFunction (line 40) | type GuardrailFunction = keyof MistralResponse['results'][0]['categories'];
FILE: plugins/mistral/mistral.test.ts
function getParameters (line 5) | function getParameters() {
FILE: plugins/pangea/textGuard.ts
function errorToString (line 101) | function errorToString(response: any): string {
FILE: plugins/pangea/version.ts
constant VERSION (line 1) | const VERSION = 'v1.0.0-beta';
FILE: plugins/panw-prisma-airs/intercept.ts
constant AIRS_URL (line 9) | const AIRS_URL =
FILE: plugins/patronus/globals.ts
constant BASE_URL (line 3) | const BASE_URL = 'https://api.patronus.ai/v1/evaluate';
type Position (line 34) | interface Position {
type AllLongestPositionsResult (line 41) | interface AllLongestPositionsResult {
function findAllLongestPositions (line 46) | function findAllLongestPositions(
FILE: plugins/patronus/pii.ts
function maskEntities (line 10) | function maskEntities(
FILE: plugins/pillar/globals.ts
constant PILLAR_BASE_URL (line 3) | const PILLAR_BASE_URL = 'https://api.pillarseclabs.com/api/v1';
FILE: plugins/pillar/pillar.test.ts
function getParameters (line 5) | function getParameters(
FILE: plugins/portkey/globals.ts
constant BASE_URL (line 5) | const BASE_URL = 'https://api.portkey.ai/v1/execute-guardrails';
constant PORTKEY_ENDPOINTS (line 7) | const PORTKEY_ENDPOINTS = {
type PIIEntity (line 14) | interface PIIEntity {
type PIIResponse (line 19) | interface PIIResponse {
type PIIResult (line 24) | interface PIIResult {
type LogObjectRequest (line 30) | interface LogObjectRequest {
type LogObjectResponse (line 38) | interface LogObjectResponse {
type LogObjectMetadata (line 46) | interface LogObjectMetadata extends Record<string, any> {
type LogObject (line 53) | interface LogObject {
type PIIParameters (line 60) | interface PIIParameters extends PluginParameters {
function generateSpanId (line 137) | function generateSpanId(): string {
FILE: plugins/portkey/pii.ts
function detectPII (line 20) | async function detectPII(
FILE: plugins/promptfoo/globals.ts
constant PROMPTFOO_BASE_URL (line 4) | const PROMPTFOO_BASE_URL = 'https://api.promptfoo.dev/v1';
FILE: plugins/promptfoo/types.ts
type PromptfooResult (line 2) | interface PromptfooResult<T> {
type GuardCategories (line 8) | interface GuardCategories {
type GuardCategoryScores (line 13) | interface GuardCategoryScores {
type GuardResult (line 18) | interface GuardResult {
type PIIEntity (line 25) | interface PIIEntity {
type PIICategories (line 32) | interface PIICategories {
type PIICategoryScores (line 36) | interface PIICategoryScores {
type PIIPayload (line 40) | interface PIIPayload {
type PIIResult (line 44) | interface PIIResult {
type HarmCategories (line 52) | interface HarmCategories {
type HarmCategoryScores (line 69) | interface HarmCategoryScores {
type HarmResult (line 86) | interface HarmResult {
FILE: plugins/promptsecurity/promptsecurity.test.ts
function getParameters (line 4) | function getParameters() {
FILE: plugins/qualifire/globals.ts
constant BASE_URL (line 3) | const BASE_URL = 'https://proxy.qualifire.ai/api/evaluation/evaluate';
type AvailableTool (line 5) | interface AvailableTool {
type ToolCall (line 11) | interface ToolCall {
type Message (line 17) | interface Message {
FILE: plugins/qualifire/qualifire.test.ts
function getParameters (line 28) | function getParameters() {
FILE: plugins/sydelabs/sydeguard.ts
constant SYDEGUARD_URL (line 9) | const SYDEGUARD_URL =
FILE: plugins/sydelabs/sydelabs.test.ts
function getParameters (line 4) | function getParameters(
FILE: plugins/types.ts
type PluginContext (line 1) | interface PluginContext {
type PluginParameters (line 8) | interface PluginParameters<K = Record<string, string>> {
type PluginHandlerResponse (line 13) | interface PluginHandlerResponse {
type HookEventType (line 22) | type HookEventType = 'beforeRequestHook' | 'afterRequestHook';
type PluginHandler (line 24) | type PluginHandler<P = Record<string, string>> = (
FILE: plugins/utils.ts
type PostOptions (line 3) | interface PostOptions extends RequestInit {
type ErrorResponse (line 8) | interface ErrorResponse {
class HttpError (line 15) | class HttpError extends Error {
method constructor (line 18) | constructor(message: string, response: ErrorResponse) {
class TimeoutError (line 25) | class TimeoutError extends Error {
method constructor (line 30) | constructor(message: string, url: string, timeout: number, method: str...
function setRequestContentPart (line 148) | function setRequestContentPart(
function setResponseContentPart (line 180) | function setResponseContentPart(
function post (line 221) | async function post<T = any>(
function postWithCloudflareServiceBinding (line 304) | async function postWithCloudflareServiceBinding<T = any>(
FILE: plugins/walledai/walledprotect.ts
constant API_URL (line 9) | const API_URL = 'https://services.walled.ai/v1/walled-protect';
constant DEFAULT_PII_LIST (line 11) | const DEFAULT_PII_LIST = [
constant DEFAULT_GREETINGS_LIST (line 21) | const DEFAULT_GREETINGS_LIST = ['Casual & Friendly'];
FILE: src/errors/GatewayError.ts
class GatewayError (line 1) | class GatewayError extends Error {
method constructor (line 2) | constructor(
FILE: src/errors/RouterError.ts
class RouterError (line 1) | class RouterError extends Error {
method constructor (line 2) | constructor(
FILE: src/globals.ts
constant POWERED_BY (line 3) | const POWERED_BY: string = 'portkey';
constant MAX_RETRY_LIMIT_MS (line 5) | const MAX_RETRY_LIMIT_MS = 60 * 1000;
constant POSSIBLE_RETRY_STATUS_HEADERS (line 7) | const POSSIBLE_RETRY_STATUS_HEADERS = [
constant HEADER_KEYS (line 13) | const HEADER_KEYS: Record<string, string> = {
constant RESPONSE_HEADER_KEYS (line 30) | const RESPONSE_HEADER_KEYS: Record<string, string> = {
constant RETRY_STATUS_CODES (line 38) | const RETRY_STATUS_CODES = [429, 500, 502, 503, 504];
constant MAX_RETRIES (line 39) | const MAX_RETRIES = 5;
constant REQUEST_TIMEOUT_STATUS_CODE (line 40) | const REQUEST_TIMEOUT_STATUS_CODE = 408;
constant PRECONDITION_CHECK_FAILED_STATUS_CODE (line 41) | const PRECONDITION_CHECK_FAILED_STATUS_CODE = 412;
constant OPEN_AI (line 43) | const OPEN_AI: string = 'openai';
constant COHERE (line 44) | const COHERE: string = 'cohere';
constant AZURE_OPEN_AI (line 45) | const AZURE_OPEN_AI: string = 'azure-openai';
constant AZURE_AI_INFERENCE (line 46) | const AZURE_AI_INFERENCE: string = 'azure-ai';
constant ANTHROPIC (line 47) | const ANTHROPIC: string = 'anthropic';
constant ANYSCALE (line 48) | const ANYSCALE: string = 'anyscale';
constant PALM (line 49) | const PALM: string = 'palm';
constant TOGETHER_AI (line 50) | const TOGETHER_AI: string = 'together-ai';
constant GOOGLE (line 51) | const GOOGLE: string = 'google';
constant GOOGLE_VERTEX_AI (line 52) | const GOOGLE_VERTEX_AI: string = 'vertex-ai';
constant HUGGING_FACE (line 53) | const HUGGING_FACE: string = 'huggingface';
constant PERPLEXITY_AI (line 54) | const PERPLEXITY_AI: string = 'perplexity-ai';
constant REKA_AI (line 55) | const REKA_AI: string = 'reka-ai';
constant MISTRAL_AI (line 56) | const MISTRAL_AI: string = 'mistral-ai';
constant DEEPINFRA (line 57) | const DEEPINFRA: string = 'deepinfra';
constant NCOMPASS (line 58) | const NCOMPASS: string = 'ncompass';
constant STABILITY_AI (line 59) | const STABILITY_AI: string = 'stability-ai';
constant NOMIC (line 60) | const NOMIC: string = 'nomic';
constant OLLAMA (line 61) | const OLLAMA: string = 'ollama';
constant AI21 (line 62) | const AI21: string = 'ai21';
constant BEDROCK (line 63) | const BEDROCK: string = 'bedrock';
constant GROQ (line 64) | const GROQ: string = 'groq';
constant SEGMIND (line 65) | const SEGMIND: string = 'segmind';
constant JINA (line 66) | const JINA: string = 'jina';
constant FIREWORKS_AI (line 67) | const FIREWORKS_AI: string = 'fireworks-ai';
constant WORKERS_AI (line 68) | const WORKERS_AI: string = 'workers-ai';
constant MOONSHOT (line 69) | const MOONSHOT: string = 'moonshot';
constant OPENROUTER (line 70) | const OPENROUTER: string = 'openrouter';
constant LINGYI (line 71) | const LINGYI: string = 'lingyi';
constant ZHIPU (line 72) | const ZHIPU: string = 'zhipu';
constant NOVITA_AI (line 73) | const NOVITA_AI: string = 'novita-ai';
constant MONSTERAPI (line 74) | const MONSTERAPI: string = 'monsterapi';
constant DEEPSEEK (line 75) | const DEEPSEEK: string = 'deepseek';
constant PREDIBASE (line 76) | const PREDIBASE: string = 'predibase';
constant TRITON (line 77) | const TRITON: string = 'triton';
constant VOYAGE (line 78) | const VOYAGE: string = 'voyage';
constant GITHUB (line 79) | const GITHUB: string = 'github';
constant DEEPBRICKS (line 80) | const DEEPBRICKS: string = 'deepbricks';
constant SILICONFLOW (line 81) | const SILICONFLOW: string = 'siliconflow';
constant CEREBRAS (line 82) | const CEREBRAS: string = 'cerebras';
constant INFERENCENET (line 83) | const INFERENCENET: string = 'inference-net';
constant SAMBANOVA (line 84) | const SAMBANOVA: string = 'sambanova';
constant LEMONFOX_AI (line 85) | const LEMONFOX_AI: string = 'lemonfox-ai';
constant UPSTAGE (line 86) | const UPSTAGE: string = 'upstage';
constant LAMBDA (line 87) | const LAMBDA: string = 'lambda';
constant DASHSCOPE (line 88) | const DASHSCOPE: string = 'dashscope';
constant X_AI (line 89) | const X_AI: string = 'x-ai';
constant CORTEX (line 90) | const CORTEX: string = 'cortex';
constant SAGEMAKER (line 91) | const SAGEMAKER: string = 'sagemaker';
constant NEBIUS (line 92) | const NEBIUS: string = 'nebius';
constant RECRAFTAI (line 93) | const RECRAFTAI: string = 'recraft-ai';
constant MILVUS (line 94) | const MILVUS: string = 'milvus';
constant REPLICATE (line 95) | const REPLICATE: string = 'replicate';
constant LEPTON (line 96) | const LEPTON: string = 'lepton';
constant KLUSTER_AI (line 97) | const KLUSTER_AI: string = 'kluster-ai';
constant NSCALE (line 98) | const NSCALE: string = 'nscale';
constant HYPERBOLIC (line 99) | const HYPERBOLIC: string = 'hyperbolic';
constant BYTEZ (line 100) | const BYTEZ: string = 'bytez';
constant FEATHERLESS_AI (line 101) | const FEATHERLESS_AI: string = 'featherless-ai';
constant KRUTRIM (line 102) | const KRUTRIM: string = 'krutrim';
constant QDRANT (line 103) | const QDRANT: string = 'qdrant';
constant THREE_ZERO_TWO_AI (line 104) | const THREE_ZERO_TWO_AI: string = '302ai';
constant COMETAPI (line 105) | const COMETAPI: string = 'cometapi';
constant MATTERAI (line 106) | const MATTERAI: string = 'matterai';
constant MESHY (line 107) | const MESHY: string = 'meshy';
constant TRIPO3D (line 108) | const TRIPO3D: string = 'tripo3d';
constant NEXTBIT (line 109) | const NEXTBIT: string = 'nextbit';
constant MODAL (line 110) | const MODAL: string = 'modal';
constant Z_AI (line 111) | const Z_AI: string = 'z-ai';
constant ORACLE (line 112) | const ORACLE: string = 'oracle';
constant IO_INTELLIGENCE (line 113) | const IO_INTELLIGENCE: string = 'iointelligence';
constant AIBADGR (line 114) | const AIBADGR: string = 'aibadgr';
constant OVHCLOUD (line 115) | const OVHCLOUD: string = 'ovhcloud';
constant VALID_PROVIDERS (line 117) | const VALID_PROVIDERS = [
constant CONTENT_TYPES (line 194) | const CONTENT_TYPES = {
constant MULTIPART_FORM_DATA_ENDPOINTS (line 207) | const MULTIPART_FORM_DATA_ENDPOINTS: endpointStrings[] = [
type BatchEndpoints (line 278) | enum BatchEndpoints {
type RateLimiterKeyTypes (line 291) | enum RateLimiterKeyTypes {
constant METRICS_KEYS (line 298) | const METRICS_KEYS = {
FILE: src/handlers/batchesHandler.ts
function batchesHandler (line 8) | function batchesHandler(endpoint: endpointStrings, method: 'POST' | 'GET...
FILE: src/handlers/chatCompletionsHandler.ts
function chatCompletionsHandler (line 16) | async function chatCompletionsHandler(c: Context): Promise<Response> {
FILE: src/handlers/completionsHandler.ts
function completionsHandler (line 16) | async function completionsHandler(c: Context): Promise<Response> {
FILE: src/handlers/createSpeechHandler.ts
function createSpeechHandler (line 15) | async function createSpeechHandler(c: Context): Promise<Response> {
FILE: src/handlers/createTranscriptionHandler.ts
function createTranscriptionHandler (line 15) | async function createTranscriptionHandler(
FILE: src/handlers/createTranslationHandler.ts
function createTranslationHandler (line 15) | async function createTranslationHandler(c: Context): Promise<Response> {
FILE: src/handlers/embeddingsHandler.ts
function embeddingsHandler (line 16) | async function embeddingsHandler(c: Context): Promise<Response> {
FILE: src/handlers/filesHandler.ts
function filesHandler (line 8) | function filesHandler(
FILE: src/handlers/finetuneHandler.ts
constant BODY_SUPPORTED_ENDPOINTS (line 30) | const BODY_SUPPORTED_ENDPOINTS = ['createFinetune'];
function finetuneHandler (line 32) | async function finetuneHandler(c: Context) {
FILE: src/handlers/handlerUtils.ts
function constructRequestBody (line 41) | function constructRequestBody(
function constructRequestHeaders (line 78) | function constructRequestHeaders(
function constructRequest (line 169) | async function constructRequest(
function selectProviderByWeight (line 204) | function selectProviderByWeight(providers: Options[]): Options {
function convertHooksShorthand (line 233) | function convertHooksShorthand(
function tryPost (line 288) | async function tryPost(
function tryTargetsRecursively (line 476) | async function tryTargetsRecursively(
function constructConfigFromRequestHeaders (line 836) | function constructConfigFromRequestHeaders(
function recursiveAfterRequestHookHandler (line 1182) | async function recursiveAfterRequestHookHandler(
function beforeRequestHookHandler (line 1300) | async function beforeRequestHookHandler(
FILE: src/handlers/imageEditsHandler.ts
function imageEditsHandler (line 16) | async function imageEditsHandler(c: Context): Promise<Response> {
FILE: src/handlers/imageGenerationsHandler.ts
function imageGenerationsHandler (line 16) | async function imageGenerationsHandler(c: Context): Promise<Response> {
FILE: src/handlers/messagesCountTokensHandler.ts
function messagesCountTokensHandler (line 16) | async function messagesCountTokensHandler(
FILE: src/handlers/messagesHandler.ts
function messagesHandler (line 16) | async function messagesHandler(c: Context): Promise<Response> {
FILE: src/handlers/modelResponsesHandler.ts
function modelResponsesHandler (line 8) | function modelResponsesHandler(
FILE: src/handlers/proxyHandler.ts
function getRequestData (line 9) | async function getRequestData(request: Request, contentType: string) {
function proxyHandler (line 26) | async function proxyHandler(c: Context): Promise<Response> {
FILE: src/handlers/realtimeHandler.ts
function realTimeHandler (line 30) | async function realTimeHandler(c: Context): Promise<Response> {
FILE: src/handlers/realtimeHandlerNode.ts
function realTimeHandlerNode (line 10) | async function realTimeHandlerNode(
FILE: src/handlers/responseHandlers.ts
function responseHandler (line 38) | async function responseHandler(
function createHookResponse (line 184) | function createHookResponse(
function afterRequestHookHandler (line 223) | async function afterRequestHookHandler(
FILE: src/handlers/retryHandler.ts
function fetchWithTimeout (line 4) | async function fetchWithTimeout(
FILE: src/handlers/services/cacheService.ts
type CacheResponseObject (line 9) | interface CacheResponseObject {
class CacheService (line 16) | class CacheService {
method constructor (line 17) | constructor(
method isEndpointCacheable (line 22) | isEndpointCacheable(endpoint: endpointStrings): boolean {
method getFromCacheFunction (line 43) | get getFromCacheFunction() {
method getCacheIdentifier (line 47) | get getCacheIdentifier() {
method noCacheObject (line 51) | get noCacheObject(): CacheResponseObject {
method createResponseObject (line 60) | private createResponseObject(
method getCachedResponse (line 78) | async getCachedResponse(
FILE: src/handlers/services/hooksService.ts
class HooksService (line 7) | class HooksService {
method constructor (line 10) | constructor(private requestContext: RequestContext) {
method createSpan (line 15) | createSpan(): HookSpan {
method hookSpan (line 40) | get hookSpan(): HookSpan {
method results (line 44) | get results(): AllHookResults | undefined {
method areSyncHooksAvailable (line 48) | get areSyncHooksAvailable(): boolean {
method hasFailedHooks (line 60) | hasFailedHooks(hookType: 'beforeRequest' | 'afterRequest' | 'any'): bo...
method hasResults (line 78) | hasResults(hookType: 'beforeRequest' | 'afterRequest' | 'any'): boolean {
FILE: src/handlers/services/logsService.ts
type LogObject (line 36) | interface LogObject {
type otlpSpanObject (line 64) | interface otlpSpanObject {
class LogsService (line 94) | class LogsService {
method constructor (line 95) | constructor(private honoContext: Context) {}
method createExecuteToolSpan (line 97) | createExecuteToolSpan(
method createLogObject (line 165) | async createLogObject(
method requestLogs (line 206) | get requestLogs(): any[] {
method addRequestLog (line 210) | addRequestLog(log: any) {
class LogObjectBuilder (line 215) | class LogObjectBuilder {
method constructor (line 219) | constructor(
method clone (line 239) | private clone() {
method updateRequestContext (line 278) | updateRequestContext(
method addResponse (line 298) | addResponse(
method addExecutionTime (line 309) | addExecutionTime(createdAt: Date) {
method addTransformedRequest (line 315) | addTransformedRequest(
method addCache (line 326) | addCache(cacheStatus?: string, cacheKey?: string) {
method addHookSpanId (line 332) | addHookSpanId(hookSpanId: string) {
method log (line 338) | log(): this {
method isComplete (line 361) | private isComplete(obj: unknown): obj is LogObject {
method commit (line 467) | commit(): void {
method isDestroyed (line 479) | isDestroyed(): boolean {
method [Symbol.dispose] (line 483) | [Symbol.dispose]() {
FILE: src/handlers/services/preRequestValidatorService.ts
class PreRequestValidatorService (line 6) | class PreRequestValidatorService {
method constructor (line 8) | constructor(
method getResponse (line 15) | async getResponse(): Promise<{
FILE: src/handlers/services/providerContext.ts
class ProviderContext (line 13) | class ProviderContext {
method constructor (line 14) | constructor(private provider: string) {
method providerConfig (line 20) | get providerConfig(): ProviderConfigs {
method apiConfig (line 24) | get apiConfig(): ProviderAPIConfig {
method getHeaders (line 28) | async getHeaders(context: RequestContext): Promise<Record<string, any>> {
method getBaseURL (line 43) | async getBaseURL(context: RequestContext): Promise<string> {
method getEndpointPath (line 53) | getEndpointPath(context: RequestContext): string {
method getProxyPath (line 64) | getProxyPath(context: RequestContext, baseURL: string): string {
method getFullURL (line 96) | async getFullURL(context: RequestContext): Promise<string> {
method requestHandlers (line 109) | get requestHandlers(): RequestHandlers {
method hasRequestHandler (line 113) | hasRequestHandler(context: RequestContext): boolean {
method getRequestHandler (line 117) | getRequestHandler(
FILE: src/handlers/services/requestContext.ts
class RequestContext (line 16) | class RequestContext {
method constructor (line 22) | constructor(
method requestURL (line 39) | get requestURL(): string {
method requestURL (line 43) | set requestURL(requestURL: string) {
method overrideParams (line 47) | get overrideParams(): Params {
method params (line 51) | get params(): Params {
method params (line 62) | set params(params: Params) {
method transformedRequestBody (line 66) | set transformedRequestBody(transformedRequestBody: any) {
method transformedRequestBody (line 70) | get transformedRequestBody(): any {
method getHeader (line 74) | getHeader(key: string): string {
method traceId (line 85) | get traceId(): string {
method isStreaming (line 89) | get isStreaming(): boolean {
method strictOpenAiCompliance (line 99) | get strictOpenAiCompliance(): boolean {
method metadata (line 110) | get metadata(): Record<string, string> {
method forwardHeaders (line 118) | get forwardHeaders(): string[] {
method customHost (line 127) | get customHost(): string {
method requestTimeout (line 135) | get requestTimeout(): number | null {
method provider (line 144) | get provider(): string {
method normalizeRetryConfig (line 148) | private normalizeRetryConfig(retry?: RetrySettings): RetrySettings {
method retryConfig (line 158) | get retryConfig(): RetrySettings {
method cacheConfig (line 162) | get cacheConfig(): CacheSettings & { cacheStatus: string } {
method hasRetries (line 184) | hasRetries(): boolean {
method beforeRequestHooks (line 188) | get beforeRequestHooks(): HookObject[] {
method afterRequestHooks (line 195) | get afterRequestHooks(): HookObject[] {
method hooksManager (line 202) | get hooksManager(): HooksManager {
method transformToProviderRequestAndSave (line 211) | transformToProviderRequestAndSave() {
method requestOptions (line 226) | get requestOptions(): any[] {
method appendRequestOptions (line 230) | appendRequestOptions(requestOptions: any) {
method updateModelPricingConfig (line 237) | updateModelPricingConfig(modelPricingConfig: Record<string, any>) {
FILE: src/handlers/services/responseService.ts
type CreateResponseOptions (line 9) | interface CreateResponseOptions {
class ResponseService (line 25) | class ResponseService {
method constructor (line 26) | constructor(
method create (line 31) | async create(options: CreateResponseOptions): Promise<{
method getResponse (line 73) | async getResponse(
method updateHeaders (line 99) | updateHeaders(
FILE: src/handlers/streamHandler.ts
function readUInt32BE (line 19) | function readUInt32BE(buffer: Uint8Array, offset: number) {
function getPayloadFromAWSChunk (line 38) | function getPayloadFromAWSChunk(chunk: Uint8Array): string {
function concatenateUint8Arrays (line 54) | function concatenateUint8Arrays(a: Uint8Array, b: Uint8Array): Uint8Array {
function handleTextResponse (line 211) | async function handleTextResponse(
function handleNonStreamingMode (line 235) | async function handleNonStreamingMode(
function handleAudioResponse (line 288) | function handleAudioResponse(response: Response) {
function handleOctetStreamResponse (line 292) | function handleOctetStreamResponse(response: Response) {
function handleImageResponse (line 296) | function handleImageResponse(response: Response) {
function handleStreamingMode (line 300) | function handleStreamingMode(
function handleJSONToStreamResponse (line 414) | async function handleJSONToStreamResponse(
FILE: src/handlers/streamHandlerUtils.ts
method transform (line 145) | transform(chunk, controller) {
method transform (line 223) | transform(chunk, controller) {
method transform (line 250) | transform(chunk, controller) {
function createLineSplitter (line 302) | function createLineSplitter(): TransformStream {
FILE: src/middlewares/cache/index.ts
constant CACHE_STATUS (line 5) | const CACHE_STATUS = {
FILE: src/middlewares/hooks/globals.ts
constant HOOKS_EVENT_TYPE_PRESETS (line 1) | const HOOKS_EVENT_TYPE_PRESETS = {
FILE: src/middlewares/hooks/index.ts
class HookSpan (line 18) | class HookSpan {
method constructor (line 29) | constructor(
method createContext (line 64) | private createContext(
method extractRequestText (line 93) | private extractRequestText(requestParams: any): string {
method initializeHooks (line 113) | private initializeHooks(
method setContextResponse (line 120) | public setContextResponse(
method setContextAfterTransform (line 133) | public setContextAfterTransform(
method extractResponseText (line 150) | private extractResponseText(responseJSON: Record<string, any>): string {
method addHookResult (line 162) | public addHookResult(eventType: EventType, result: HookResult): void {
method resetHookResult (line 170) | public resetHookResult(eventType: EventType): void {
method getContext (line 178) | public getContext(): HookSpanContext {
method getBeforeRequestHooks (line 182) | public getBeforeRequestHooks(): HookObject[] {
method getAfterRequestHooks (line 186) | public getAfterRequestHooks(): HookObject[] {
method getParentHookSpanId (line 190) | public getParentHookSpanId(): string | null {
method getHooksResult (line 194) | public getHooksResult(): {
class HooksManager (line 202) | class HooksManager {
method constructor (line 206) | constructor() {
method createSpan (line 210) | public createSpan(
method setSpanContextResponse (line 237) | public setSpanContextResponse(
method executeHooks (line 246) | public async executeHooks(
method getSpan (line 277) | public getSpan(spanId: string): HookSpan {
method executeFunction (line 282) | private async executeFunction(
method executeEachHook (line 328) | private async executeEachHook(
method shouldSkipHook (line 449) | private shouldSkipHook(span: HookSpan, hook: HookObject): boolean {
method createFeedbackObject (line 466) | private createFeedbackObject(
method getCheckIds (line 490) | private getCheckIds(
method getHooksToExecute (line 505) | public getHooksToExecute(
FILE: src/middlewares/hooks/types.ts
type Check (line 1) | interface Check {
type HookOnFailObject (line 7) | interface HookOnFailObject {
type HookOnSuccessObject (line 11) | interface HookOnSuccessObject {
type HookObject (line 17) | interface HookObject {
type HookSpanContextRequest (line 29) | interface HookSpanContextRequest {
type HookSpanContextResponse (line 37) | interface HookSpanContextResponse {
type HookSpanContext (line 45) | interface HookSpanContext {
type GuardrailFeedbackMetadata (line 53) | interface GuardrailFeedbackMetadata {
type GuardrailFeedback (line 59) | interface GuardrailFeedback {
type HookFeedback (line 65) | type HookFeedback = GuardrailFeedback;
type GuardrailCheckResult (line 67) | interface GuardrailCheckResult {
type GuardrailResult (line 87) | interface GuardrailResult {
type HookResult (line 103) | type HookResult = GuardrailResult;
type AllHookResults (line 105) | type AllHookResults = {
type EventType (line 110) | type EventType = 'beforeRequestHook' | 'afterRequestHook';
type HookType (line 112) | enum HookType {
type HandlerOptions (line 117) | interface HandlerOptions {
FILE: src/middlewares/log/index.ts
constant MAX_RESPONSE_LENGTH (line 5) | const MAX_RESPONSE_LENGTH = 100000;
function processLog (line 50) | async function processLog(c: Context, start: number) {
FILE: src/middlewares/requestValidator/index.ts
constant VALIDATION_PATTERNS (line 7) | const VALIDATION_PATTERNS = {
constant DISALLOWED_SCHEMES (line 21) | const DISALLOWED_SCHEMES = ['file://', 'data:', 'gopher:', 'ftp://', 'ft...
constant BLOCKED_HOSTS (line 24) | const BLOCKED_HOSTS = [
constant BLOCKED_TLDS (line 34) | const BLOCKED_TLDS = [
constant IPV4_RANGES (line 65) | const IPV4_RANGES = {
function isValidCustomHost (line 232) | function isValidCustomHost(customHost: string, c?: Context) {
function intToIPv4 (line 343) | function intToIPv4(num: number): string {
function ipv4ToInt (line 352) | function ipv4ToInt(ip: string): number {
function isValidPort (line 358) | function isValidPort(port: string): boolean {
function isIPv4 (line 363) | function isIPv4(parts: string[]): boolean {
function isPrivateIPv4 (line 382) | function isPrivateIPv4(ip: string): boolean {
function isReservedIPv4 (line 389) | function isReservedIPv4(ip: string): boolean {
function isLocalOrPrivateIPv6 (line 396) | function isLocalOrPrivateIPv6(host: string): boolean {
function isAlternativeIPRepresentation (line 405) | function isAlternativeIPRepresentation(host: string, parts: string[]): b...
FILE: src/providers/302ai/chatComplete.ts
type AI302ChatCompleteResponse (line 59) | interface AI302ChatCompleteResponse extends ChatCompletionResponse {
type AI302StreamChunk (line 71) | interface AI302StreamChunk {
FILE: src/providers/ai21/chatComplete.ts
type AI21ChatCompleteResponse (line 110) | interface AI21ChatCompleteResponse {
FILE: src/providers/ai21/complete.ts
type AI21CompleteResponse (line 68) | interface AI21CompleteResponse {
type AI21ErrorResponse (line 88) | interface AI21ErrorResponse {
FILE: src/providers/ai21/embed.ts
type AI21EmbedResponse (line 25) | interface AI21EmbedResponse {
FILE: src/providers/aibadgr/chatComplete.ts
type AIBadgrStreamChunk (line 3) | interface AIBadgrStreamChunk {
FILE: src/providers/anthropic-base/constants.ts
constant ANTHROPIC_MESSAGE_START_EVENT (line 1) | const ANTHROPIC_MESSAGE_START_EVENT = JSON.stringify({
constant ANTHROPIC_MESSAGE_DELTA_EVENT (line 20) | const ANTHROPIC_MESSAGE_DELTA_EVENT = JSON.stringify({
constant ANTHROPIC_MESSAGE_STOP_EVENT (line 34) | const ANTHROPIC_MESSAGE_STOP_EVENT = {
constant ANTHROPIC_CONTENT_BLOCK_STOP_EVENT (line 38) | const ANTHROPIC_CONTENT_BLOCK_STOP_EVENT = JSON.stringify({
constant ANTHROPIC_CONTENT_BLOCK_START_EVENT (line 43) | const ANTHROPIC_CONTENT_BLOCK_START_EVENT = JSON.stringify({
FILE: src/providers/anthropic-base/types.ts
type AnthropicMessageStartEvent (line 1) | interface AnthropicMessageStartEvent {
type AnthropicMessageDeltaEvent (line 20) | interface AnthropicMessageDeltaEvent {
FILE: src/providers/anthropic-base/utils/streamGenerator.ts
constant MESSAGE_STOP_EVENT (line 29) | const MESSAGE_STOP_EVENT = `event: message_stop\ndata: {"type": "message...
FILE: src/providers/anthropic/chatComplete.ts
type AnthropicTool (line 30) | interface AnthropicTool extends PromptCache {
type AnthropicToolResultContentItem (line 65) | interface AnthropicToolResultContentItem {
type AnthropicBase64ImageContentItem (line 80) | interface AnthropicBase64ImageContentItem {
type AnthropicUrlImageContentItem (line 89) | interface AnthropicUrlImageContentItem {
type AnthropicTextContentItem (line 97) | interface AnthropicTextContentItem {
type AnthropicUrlPdfContentItem (line 102) | interface AnthropicUrlPdfContentItem {
type AnthropicBase64PdfContentItem (line 110) | interface AnthropicBase64PdfContentItem {
type AnthropicPlainTextContentItem (line 119) | interface AnthropicPlainTextContentItem {
type AnthropicMessageContentItem (line 128) | type AnthropicMessageContentItem =
type AnthropicMessage (line 137) | interface AnthropicMessage extends Message, PromptCache {
type AnthorpicTextContentItem (line 474) | interface AnthorpicTextContentItem {
type AnthropicToolContentItem (line 479) | interface AnthropicToolContentItem {
type AnthropicContentItem (line 486) | type AnthropicContentItem = AnthorpicTextContentItem | AnthropicToolCont...
type AnthropicChatCompleteResponse (line 488) | interface AnthropicChatCompleteResponse {
type AnthropicChatCompleteStreamResponse (line 504) | interface AnthropicChatCompleteStreamResponse {
FILE: src/providers/anthropic/complete.ts
type AnthropicCompleteResponse (line 65) | interface AnthropicCompleteResponse {
FILE: src/providers/anthropic/types.ts
type AnthropicStreamState (line 1) | type AnthropicStreamState = {
type AnthropicErrorObject (line 15) | interface AnthropicErrorObject {
type AnthropicErrorResponse (line 20) | interface AnthropicErrorResponse {
type ANTHROPIC_STOP_REASON (line 26) | enum ANTHROPIC_STOP_REASON {
FILE: src/providers/anyscale/chatComplete.ts
type AnyscaleChatCompleteResponse (line 104) | interface AnyscaleChatCompleteResponse extends ChatCompletionResponse {}
type AnyscaleValidationErrorResponse (line 106) | interface AnyscaleValidationErrorResponse {
type AnyscaleErrorResponse (line 114) | interface AnyscaleErrorResponse extends ErrorResponse {}
type AnyscaleStreamChunk (line 116) | interface AnyscaleStreamChunk {
FILE: src/providers/anyscale/complete.ts
type AnyscaleCompleteResponse (line 77) | interface AnyscaleCompleteResponse extends CompletionResponse {}
type AnyscaleCompleteStreamChunk (line 78) | interface AnyscaleCompleteStreamChunk {
FILE: src/providers/anyscale/embed.ts
type AnyscaleEmbedResponse (line 26) | interface AnyscaleEmbedResponse extends EmbedResponse {}
FILE: src/providers/azure-ai-inference/api.ts
constant NON_INFERENCE_ENDPOINTS (line 11) | const NON_INFERENCE_ENDPOINTS = [
FILE: src/providers/azure-ai-inference/chatComplete.ts
type AzureAIInferenceChatCompleteResponse (line 128) | interface AzureAIInferenceChatCompleteResponse extends ChatCompletionRes...
FILE: src/providers/azure-ai-inference/complete.ts
type AzureAIInferenceCompleteResponse (line 54) | interface AzureAIInferenceCompleteResponse extends CompletionResponse {}
FILE: src/providers/azure-ai-inference/embed.ts
type AzureAIInferenceEmbedResponse (line 19) | interface AzureAIInferenceEmbedResponse extends EmbedResponse {}
FILE: src/providers/azure-openai/chatComplete.ts
type AzureOpenAIChatCompleteResponse (line 130) | interface AzureOpenAIChatCompleteResponse extends ChatCompletionResponse {}
FILE: src/providers/azure-openai/complete.ts
type AzureOpenAICompleteResponse (line 72) | interface AzureOpenAICompleteResponse extends CompletionResponse {}
FILE: src/providers/azure-openai/embed.ts
type AzureOpenAIEmbedResponse (line 29) | interface AzureOpenAIEmbedResponse extends EmbedResponse {}
FILE: src/providers/azure-openai/imageGenerate.ts
type AzureOpenAIImageObject (line 37) | interface AzureOpenAIImageObject {
type AzureOpenAIImageGenerateResponse (line 43) | interface AzureOpenAIImageGenerateResponse extends ImageGenerateResponse {
FILE: src/providers/azure-openai/utils.ts
function getAccessTokenFromEntraId (line 6) | async function getAccessTokenFromEntraId(
function getAzureManagedIdentityToken (line 43) | async function getAzureManagedIdentityToken(
function getAzureWorkloadIdentityToken (line 71) | async function getAzureWorkloadIdentityToken(
FILE: src/providers/bedrock/api.ts
type BedrockAPIConfigInterface (line 14) | interface BedrockAPIConfigInterface extends Omit<ProviderAPIConfig, 'hea...
constant AWS_CONTROL_PLANE_ENDPOINTS (line 26) | const AWS_CONTROL_PLANE_ENDPOINTS: endpointStrings[] = [
constant AWS_GET_METHODS (line 40) | const AWS_GET_METHODS: endpointStrings[] = [
constant BEDROCK_NO_MODEL_ENDPOINTS (line 52) | const BEDROCK_NO_MODEL_ENDPOINTS: endpointStrings[] = [
constant ENDPOINTS_TO_ROUTE_TO_S3 (line 62) | const ENDPOINTS_TO_ROUTE_TO_S3 = [
FILE: src/providers/bedrock/chatComplete.ts
type BedrockChatCompletionsParams (line 48) | interface BedrockChatCompletionsParams extends Params {
type BedrockConverseAnthropicChatCompletionsParams (line 66) | interface BedrockConverseAnthropicChatCompletionsParams
type BedrockConverseCohereChatCompletionsParams (line 77) | interface BedrockConverseCohereChatCompletionsParams
type BedrockConverseAI21ChatCompletionsParams (line 85) | interface BedrockConverseAI21ChatCompletionsParams
FILE: src/providers/bedrock/complete.ts
type BedrockLlamaCompleteResponse (line 248) | interface BedrockLlamaCompleteResponse {
type BedrockLlamaStreamChunk (line 304) | interface BedrockLlamaStreamChunk {
type BedrockTitanCompleteResponse (line 382) | interface BedrockTitanCompleteResponse {
type BedrockTitanStreamChunk (line 443) | interface BedrockTitanStreamChunk {
type BedrockAI21CompleteResponse (line 523) | interface BedrockAI21CompleteResponse {
type BedrockAnthropicCompleteResponse (line 593) | interface BedrockAnthropicCompleteResponse {
type BedrockAnthropicStreamChunk (line 651) | interface BedrockAnthropicStreamChunk {
type BedrockCohereCompleteResponse (line 741) | interface BedrockCohereCompleteResponse {
type BedrockCohereStreamChunk (line 801) | interface BedrockCohereStreamChunk {
type BedrocMistralStreamChunk (line 880) | interface BedrocMistralStreamChunk {
type BedrockMistralCompleteResponse (line 957) | interface BedrockMistralCompleteResponse {
FILE: src/providers/bedrock/constants.ts
constant BEDROCK_STABILITY_V1_MODELS (line 1) | const BEDROCK_STABILITY_V1_MODELS = [
constant LLAMA_2_SPECIAL_TOKENS (line 13) | const LLAMA_2_SPECIAL_TOKENS = {
constant LLAMA_3_SPECIAL_TOKENS (line 22) | const LLAMA_3_SPECIAL_TOKENS = {
constant MISTRAL_CONTROL_TOKENS (line 33) | const MISTRAL_CONTROL_TOKENS = {
FILE: src/providers/bedrock/createBatch.ts
type BedrockCreateBatchRequest (line 13) | interface BedrockCreateBatchRequest extends CreateBatchRequest {
FILE: src/providers/bedrock/createFinetune.ts
constant OK_STATUS (line 84) | const OK_STATUS = [200, 201];
FILE: src/providers/bedrock/embed.ts
type BedrockTitanEmbedResponse (line 142) | interface BedrockTitanEmbedResponse {
type BedrockErrorResponse (line 147) | interface BedrockErrorResponse extends ErrorResponse {
type BedrockCohereEmbedResponse (line 196) | interface BedrockCohereEmbedResponse {
FILE: src/providers/bedrock/imageGenerate.ts
type ImageArtifact (line 45) | interface ImageArtifact {
type BedrockStabilityAIImageGenerateV1Response (line 51) | interface BedrockStabilityAIImageGenerateV1Response {
type BedrockStabilityAIImageGenerateV2Response (line 78) | interface BedrockStabilityAIImageGenerateV2Response {
FILE: src/providers/bedrock/messages.ts
function createContentBlockStartEvent (line 516) | function createContentBlockStartEvent(
function getMessageStartEvent (line 620) | function getMessageStartEvent(fallbackId: string, gatewayRequest: Params) {
FILE: src/providers/bedrock/types.ts
type BedrockBatch (line 3) | interface BedrockBatch {
type BedrockGetBatchResponse (line 36) | interface BedrockGetBatchResponse extends BedrockBatch {}
type BedrockListBatchesResponse (line 38) | interface BedrockListBatchesResponse {
type BedrockFinetuneRecord (line 43) | interface BedrockFinetuneRecord {
type BedrockInferenceProfile (line 70) | interface BedrockInferenceProfile {
type BEDROCK_STOP_REASON (line 85) | enum BEDROCK_STOP_REASON {
type BedrockMessagesParams (line 94) | interface BedrockMessagesParams extends MessageCreateParamsBase {
type BedrockMessagesToolParam (line 117) | interface BedrockMessagesToolParam {
type BedrockChatCompletionResponse (line 139) | interface BedrockChatCompletionResponse {
type BedrockContentItem (line 161) | type BedrockContentItem = {
type BedrockStreamState (line 211) | interface BedrockStreamState {
type BedrockContentBlockDelta (line 217) | interface BedrockContentBlockDelta {
type BedrockChatCompleteStreamChunk (line 231) | interface BedrockChatCompleteStreamChunk {
type BEDROCK_CONVERSE_STOP_REASON (line 258) | enum BEDROCK_CONVERSE_STOP_REASON {
type TITAN_STOP_REASON (line 267) | enum TITAN_STOP_REASON {
FILE: src/providers/bedrock/uploadFile.ts
class AwsMultipartUploadHandler (line 18) | class AwsMultipartUploadHandler {
method constructor (line 29) | constructor(
method initiateMultipartUpload (line 46) | async initiateMultipartUpload() {
method chunkAndUploadStream (line 78) | async chunkAndUploadStream(
method uploadPart (line 170) | async uploadPart(partNumber: number, partData: Uint8Array | Buffer) {
method completeMultipartUpload (line 207) | async completeMultipartUpload() {
FILE: src/providers/bedrock/uploadFileUtils.ts
type AnthropicTool (line 33) | interface AnthropicTool {
type AnthropicToolResultContentItem (line 49) | interface AnthropicToolResultContentItem {
type AnthropicMessageContentItem (line 55) | type AnthropicMessageContentItem = AnthropicToolResultContentItem | Cont...
type AnthropicMessage (line 57) | interface AnthropicMessage extends Message {
type AnthropicTextContentItem (line 61) | interface AnthropicTextContentItem {
type AnthropicToolContentItem (line 66) | interface AnthropicToolContentItem {
type AnthropicContentItem (line 73) | type AnthropicContentItem = AnthropicTextContentItem | AnthropicToolCont...
type BedrockAnthropicChatCompleteResponse (line 829) | interface BedrockAnthropicChatCompleteResponse {
type BedrockChatCompletionLine (line 980) | type BedrockChatCompletionLine = {
FILE: src/providers/bedrock/utils.ts
function getAssumedRoleCredentials (line 229) | async function getAssumedRoleCredentials(
function parseXml (line 323) | function parseXml(xml: string) {
function providerAssumedRoleCredentials (line 388) | async function providerAssumedRoleCredentials(
FILE: src/providers/bytez/chatComplete.ts
function chatComplete (line 34) | function chatComplete(
FILE: src/providers/bytez/types.ts
type Model (line 1) | interface Model {
type BytezResponse (line 5) | interface BytezResponse {
FILE: src/providers/cohere/complete.ts
type CohereCompleteResponse (line 69) | interface CohereCompleteResponse {
type CohereStreamChunk (line 85) | interface CohereStreamChunk {
FILE: src/providers/cohere/embed.ts
type ApiVersion (line 76) | interface ApiVersion {
type EmbedMeta (line 85) | interface EmbedMeta {
type CohereEmbedResponse (line 107) | interface CohereEmbedResponse {
type CohereEmbedResponseBatch (line 186) | interface CohereEmbedResponseBatch {
FILE: src/providers/cohere/types.ts
type CohereStreamState (line 1) | type CohereStreamState = {
type CohereErrorResponse (line 6) | interface CohereErrorResponse {
type CohereDatasetUploadStatus (line 10) | type CohereDatasetUploadStatus =
type CohereDataset (line 19) | interface CohereDataset {
type CohereGetFileResponse (line 47) | interface CohereGetFileResponse {
type CohereGetFilesResponse (line 51) | interface CohereGetFilesResponse {
type CohereBatchMeta (line 55) | interface CohereBatchMeta {
type CohereCreateBatchResponse (line 75) | interface CohereCreateBatchResponse {
type CohereBatch (line 80) | interface CohereBatch {
type CohereListBatchResponse (line 98) | interface CohereListBatchResponse {
type CohereRetrieveBatchResponse (line 102) | interface CohereRetrieveBatchResponse extends CohereBatch {}
type COHERE_STOP_REASON (line 104) | enum COHERE_STOP_REASON {
type CohereChatCompletionStreamChunk (line 113) | type CohereChatCompletionStreamChunk =
type ChatContentStartEventDeltaMessageContentType (line 127) | type ChatContentStartEventDeltaMessageContentType = 'text' | 'thinking';
type LogprobItem (line 129) | interface LogprobItem {
type ToolCallV2Function (line 138) | interface ToolCallV2Function {
type ToolCallV2 (line 143) | interface ToolCallV2 {
type UsageBilledUnits (line 149) | interface UsageBilledUnits {
type UsageTokens (line 160) | interface UsageTokens {
type Usage (line 167) | interface Usage {
type Citation (line 172) | interface Citation {
type MessageStart (line 186) | interface MessageStart {
type ContentStart (line 196) | interface ContentStart {
type ContentDelta (line 210) | interface ContentDelta {
type ContentEnd (line 224) | interface ContentEnd {
type ToolPlanDelta (line 229) | interface ToolPlanDelta {
type ToolCallStart (line 239) | interface ToolCallStart {
type ToolCallDelta (line 249) | interface ToolCallDelta {
type ToolCallEnd (line 259) | interface ToolCallEnd {
type CitationStart (line 264) | interface CitationStart {
type CitationEnd (line 274) | interface CitationEnd {
type MessageEnd (line 279) | interface MessageEnd {
type Debug (line 289) | interface Debug {
type CohereChatCompleteResponse (line 294) | interface CohereChatCompleteResponse {
type CohereErrorResponse (line 324) | interface CohereErrorResponse {
FILE: src/providers/cohere/uploadFile.ts
type CohereCreateDatasetResponse (line 8) | interface CohereCreateDatasetResponse {
FILE: src/providers/cometapi/api.ts
constant DEFAULT_COMETAPI_BASE_URL (line 3) | const DEFAULT_COMETAPI_BASE_URL = 'https://api.cometapi.com/v1';
FILE: src/providers/cometapi/chatComplete.ts
type CometAPIStreamChunk (line 15) | interface CometAPIStreamChunk {
FILE: src/providers/dashscope/api.ts
method headers (line 5) | headers({ providerOptions }) {
method getEndpoint (line 9) | getEndpoint({ fn }) {
FILE: src/providers/deepbricks/chatComplete.ts
type DeepbricksChatCompleteResponse (line 107) | interface DeepbricksChatCompleteResponse extends ChatCompletionResponse {
FILE: src/providers/deepbricks/imageGenerate.ts
type DeepbricksImageObject (line 37) | interface DeepbricksImageObject {
type DeepbricksImageGenerateResponse (line 43) | interface DeepbricksImageGenerateResponse extends ImageGenerateResponse {
FILE: src/providers/deepinfra/chatComplete.ts
type DeepInfraChatCompleteResponse (line 83) | interface DeepInfraChatCompleteResponse extends ChatCompletionResponse {
type DeepInfraErrorResponse (line 95) | interface DeepInfraErrorResponse {
type DeepInfraStreamChunk (line 103) | interface DeepInfraStreamChunk {
FILE: src/providers/deepseek/chatComplete.ts
type DeepSeekChatCompleteResponse (line 90) | interface DeepSeekChatCompleteResponse extends ChatCompletionResponse {
type DeepSeekErrorResponse (line 102) | interface DeepSeekErrorResponse {
type DeepSeekStreamChunk (line 110) | interface DeepSeekStreamChunk {
FILE: src/providers/deepseek/types.ts
type DEEPSEEK_STOP_REASON (line 1) | enum DEEPSEEK_STOP_REASON {
FILE: src/providers/featherless-ai/api.ts
method headers (line 5) | headers({ providerOptions }) {
method getEndpoint (line 9) | getEndpoint({ fn }) {
FILE: src/providers/fireworks-ai/chatComplete.ts
type FireworksAIChatCompleteResponse (line 104) | interface FireworksAIChatCompleteResponse extends ChatCompletionResponse {
type FireworksAIValidationErrorResponse (line 116) | interface FireworksAIValidationErrorResponse {
type FireworksAIErrorResponse (line 125) | interface FireworksAIErrorResponse extends ErrorResponse {}
type FireworksAIStreamChunk (line 127) | interface FireworksAIStreamChunk {
FILE: src/providers/fireworks-ai/complete.ts
type FireworksAICompleteResponse (line 84) | interface FireworksAICompleteResponse extends CompletionResponse {
type FireworksAICompleteStreamChunk (line 132) | interface FireworksAICompleteStreamChunk {
FILE: src/providers/fireworks-ai/embed.ts
type FireworksAIEmbedResponse (line 32) | interface FireworksAIEmbedResponse extends EmbedResponse {}
FILE: src/providers/fireworks-ai/imageGenerate.ts
type FireworksAIImageObject (line 81) | interface FireworksAIImageObject {
FILE: src/providers/fireworks-ai/types.ts
type FireworksFile (line 1) | interface FireworksFile {
type FinetuneState (line 32) | enum FinetuneState {
type FinetuneResponse (line 46) | interface FinetuneResponse {
FILE: src/providers/fireworks-ai/uploadFile.ts
method transform (line 62) | transform(chunk, controller) {
method flush (line 71) | flush(controller) {
FILE: src/providers/google-vertex-ai/api.ts
constant FILE_ENDPOINTS (line 30) | const FILE_ENDPOINTS = [
constant BATCH_ENDPOINTS (line 38) | const BATCH_ENDPOINTS = [
constant NON_INFERENCE_ENDPOINTS (line 49) | const NON_INFERENCE_ENDPOINTS = [...FILE_ENDPOINTS, ...BATCH_ENDPOINTS];
FILE: src/providers/google-vertex-ai/chatComplete.ts
type AnthorpicTextContentItem (line 373) | interface AnthorpicTextContentItem {
type AnthropicThinkingContentItem (line 378) | interface AnthropicThinkingContentItem {
type AnthropicToolContentItem (line 384) | interface AnthropicToolContentItem {
type AnthropicContentItem (line 391) | type AnthropicContentItem =
FILE: src/providers/google-vertex-ai/embed.ts
type TASK_TYPE (line 17) | enum TASK_TYPE {
type GoogleEmbedParams (line 28) | interface GoogleEmbedParams extends EmbedParams {
FILE: src/providers/google-vertex-ai/getBatchOutput.ts
type TransformFunction (line 39) | type TransformFunction = (
method transform (line 191) | transform(chunk, controller) {
method flush (line 208) | flush(controller) {
FILE: src/providers/google-vertex-ai/imageGenerate.ts
type GoogleImageGenInstanceData (line 8) | interface GoogleImageGenInstanceData {
type GoogleImageGenResponse (line 131) | interface GoogleImageGenResponse {
FILE: src/providers/google-vertex-ai/listBatches.ts
type GoogleListBatchesResponse (line 6) | type GoogleListBatchesResponse = {
FILE: src/providers/google-vertex-ai/listFinetunes.ts
type GoogleListFinetunesResponse (line 5) | type GoogleListFinetunesResponse = {
FILE: src/providers/google-vertex-ai/transformGenerationConfig.ts
function transformGenerationConfig (line 11) | function transformGenerationConfig(params: PortkeyGeminiParams) {
function transformEmbeddingsParameters (line 86) | function transformEmbeddingsParameters(params: GoogleEmbedParams) {
function transformEmbeddingInputs (line 103) | function transformEmbeddingInputs(params: GoogleEmbedParams) {
FILE: src/providers/google-vertex-ai/types.ts
type GoogleErrorResponse (line 4) | interface GoogleErrorResponse {
type GoogleGenerateFunctionCall (line 13) | interface GoogleGenerateFunctionCall {
type GoogleResponseCandidate (line 18) | interface GoogleResponseCandidate {
type GoogleGenerateContentResponse (line 58) | interface GoogleGenerateContentResponse {
type VertexLLamaChatCompleteResponse (line 87) | interface VertexLLamaChatCompleteResponse
type VertexLlamaChatCompleteStreamChunk (line 90) | interface VertexLlamaChatCompleteStreamChunk {
type EmbedInstancesData (line 111) | type EmbedInstancesData = TextEmbedInstance | MultimodalEmbedInstance;
type TextEmbedInstance (line 113) | interface TextEmbedInstance {
type MultimodalEmbedInstance (line 117) | interface MultimodalEmbedInstance {
type EmbedPredictionsResponse (line 134) | interface EmbedPredictionsResponse {
type GoogleEmbedResponse (line 151) | interface GoogleEmbedResponse {
type GoogleSearchRetrievalTool (line 158) | interface GoogleSearchRetrievalTool {
type GoogleBatchJobStatus (line 167) | type GoogleBatchJobStatus =
type GoogleBatchRecord (line 181) | interface GoogleBatchRecord {
type GoogleFinetuneRecord (line 224) | interface GoogleFinetuneRecord {
type VERTEX_GEMINI_GENERATE_CONTENT_FINISH_REASON (line 262) | enum VERTEX_GEMINI_GENERATE_CONTENT_FINISH_REASON {
type VERTEX_MODALITY (line 274) | enum VERTEX_MODALITY {
type PortkeyGeminiParams (line 280) | interface PortkeyGeminiParams extends Params {
FILE: src/providers/google-vertex-ai/uploadFile.ts
constant PROVIDER_CONFIG (line 21) | const PROVIDER_CONFIG: Record<
method flush (line 147) | flush(controller) {
FILE: src/providers/google-vertex-ai/utils.ts
function base64UrlEncode (line 25) | function base64UrlEncode(obj: Record<string, any>): string {
function importPrivateKey (line 66) | async function importPrivateKey(pem: string): Promise<CryptoKey> {
constant OPENAI_AUDIO_FORMAT_TO_VERTEX_MIME_TYPE_MAPPING (line 716) | const OPENAI_AUDIO_FORMAT_TO_VERTEX_MIME_TYPE_MAPPING = {
FILE: src/providers/google/chatComplete.ts
constant SYSTEM_INSTRUCTION_DISABLED_MODELS (line 114) | const SYSTEM_INSTRUCTION_DISABLED_MODELS = [
type GoogleMessageRole (line 123) | type GoogleMessageRole = 'user' | 'model' | 'system' | 'function';
type GoogleFunctionCallMessagePart (line 125) | interface GoogleFunctionCallMessagePart {
type GoogleFunctionResponseMessagePart (line 129) | interface GoogleFunctionResponseMessagePart {
type GoogleMessagePart (line 139) | type GoogleMessagePart =
type GoogleInlineDataMessagePart (line 146) | interface GoogleInlineDataMessagePart {
type GoogleFileDataMessagePart (line 153) | interface GoogleFileDataMessagePart {
type GoogleMessage (line 159) | interface GoogleMessage {
type GoogleToolConfig (line 164) | interface GoogleToolConfig {
type GoogleToolChoiceType (line 193) | type GoogleToolChoiceType = 'AUTO' | 'ANY' | 'NONE';
type GoogleErrorResponse (line 509) | interface GoogleErrorResponse {
type GoogleGenerateFunctionCall (line 518) | interface GoogleGenerateFunctionCall {
type GoogleResponseCandidate (line 523) | interface GoogleResponseCandidate {
type GoogleGenerateContentResponse (line 563) | interface GoogleGenerateContentResponse {
FILE: src/providers/google/embed.ts
type GoogleEmbedResponse (line 40) | interface GoogleEmbedResponse {
FILE: src/providers/google/types.ts
type GOOGLE_GENERATE_CONTENT_FINISH_REASON (line 3) | enum GOOGLE_GENERATE_CONTENT_FINISH_REASON {
type PortkeyGeminiParams (line 17) | interface PortkeyGeminiParams extends Params {
FILE: src/providers/groq/chatComplete.ts
type GroqChatCompleteResponse (line 8) | interface GroqChatCompleteResponse extends ChatCompletionResponse {}
type GroqErrorResponse (line 10) | interface GroqErrorResponse extends ErrorResponse {}
type GroqStreamChunkUsage (line 12) | interface GroqStreamChunkUsage {
type GroqStreamChunk (line 22) | interface GroqStreamChunk {
FILE: src/providers/huggingface/chatComplete.ts
type HuggingfaceChatCompleteResponse (line 13) | interface HuggingfaceChatCompleteResponse extends ChatCompletionResponse {}
FILE: src/providers/huggingface/complete.ts
type HuggingfaceCompleteResponse (line 8) | interface HuggingfaceCompleteResponse extends CompletionResponse {}
FILE: src/providers/huggingface/types.ts
type HuggingfaceErrorResponse (line 1) | interface HuggingfaceErrorResponse {
FILE: src/providers/hyperbolic/api.ts
constant HYPERBOLIC_API_URL (line 3) | const HYPERBOLIC_API_URL = 'https://api.hyperbolic.xyz';
FILE: src/providers/hyperbolic/chatComplete.ts
type HyperbolicStreamChunk (line 2) | interface HyperbolicStreamChunk {
FILE: src/providers/hyperbolic/imageGenerate.ts
type HyperbolicImageObject (line 25) | interface HyperbolicImageObject {
type HyperbolicImageGenerateResponse (line 31) | interface HyperbolicImageGenerateResponse {
FILE: src/providers/inference-net/api.ts
method headers (line 5) | headers({ providerOptions }) {
method getEndpoint (line 9) | getEndpoint({ fn }) {
FILE: src/providers/jina/embed.ts
type JinaEmbedResponse (line 27) | interface JinaEmbedResponse extends EmbedResponse {}
type JinaErrorResponse (line 29) | interface JinaErrorResponse {
FILE: src/providers/kluster-ai/chatComplete.ts
type KlusterAIChatCompleteResponse (line 5) | interface KlusterAIChatCompleteResponse extends ChatCompletionResponse {}
FILE: src/providers/krutrim/chatComplete.ts
type KrutrimChatCompleteResponse (line 5) | interface KrutrimChatCompleteResponse extends ChatCompletionResponse {}
type KrutrimChatCompleteErrorResponse (line 6) | interface KrutrimChatCompleteErrorResponse extends ErrorResponse {
FILE: src/providers/lambda/api.ts
method headers (line 5) | headers({ providerOptions }) {
method getEndpoint (line 12) | getEndpoint({ fn }) {
FILE: src/providers/lemonfox-ai/chatComplete.ts
type LemonfoxAIStreamChunk (line 3) | interface LemonfoxAIStreamChunk {
FILE: src/providers/lemonfox-ai/imageGenerate.ts
type LemonfoxAIImageObject (line 32) | interface LemonfoxAIImageObject {
type LemonfoxAIImageGenerateResponse (line 37) | interface LemonfoxAIImageGenerateResponse extends ImageGenerateResponse {
FILE: src/providers/lepton/api.ts
constant LEPTON_API_URL (line 3) | const LEPTON_API_URL = 'https://api.lepton.ai';
FILE: src/providers/lepton/chatComplete.ts
type LeptonChatCompleteResponse (line 9) | interface LeptonChatCompleteResponse extends ChatCompletionResponse {}
type LeptonStreamChunk (line 150) | interface LeptonStreamChunk {
FILE: src/providers/lepton/complete.ts
type LeptonCompleteResponse (line 5) | interface LeptonCompleteResponse extends CompletionResponse {}
type LeptonCompleteStreamChunk (line 142) | interface LeptonCompleteStreamChunk {
FILE: src/providers/lingyi/chatComplete.ts
type LingyiChatCompleteResponse (line 57) | interface LingyiChatCompleteResponse extends ChatCompletionResponse {
type LingyiErrorResponse (line 69) | interface LingyiErrorResponse {
type LingyiStreamChunk (line 77) | interface LingyiStreamChunk {
FILE: src/providers/matterai/api.ts
constant DEFAULT_MATTERAI_BASE_URL (line 3) | const DEFAULT_MATTERAI_BASE_URL = 'https://api.matterai.so/v1';
FILE: src/providers/matterai/chatComplete.ts
type MatterAIStreamChunk (line 15) | interface MatterAIStreamChunk {
FILE: src/providers/mistral-ai/chatComplete.ts
type MistralToolCallFunction (line 105) | interface MistralToolCallFunction {
type MistralToolCall (line 110) | interface MistralToolCall {
type MistralAIChatCompleteResponse (line 116) | interface MistralAIChatCompleteResponse extends ChatCompletionResponse {
type MistralAIErrorResponse (line 128) | interface MistralAIErrorResponse {
type MistralAIStreamChunk (line 136) | interface MistralAIStreamChunk {
FILE: src/providers/mistral-ai/embed.ts
type MistralAIEmbedResponse (line 29) | interface MistralAIEmbedResponse extends EmbedResponse {}
FILE: src/providers/mistral-ai/types.ts
type MISTRAL_AI_FINISH_REASON (line 1) | enum MISTRAL_AI_FINISH_REASON {
FILE: src/providers/modal/api.ts
method headers (line 5) | headers({ providerOptions }) {
method getEndpoint (line 12) | getEndpoint({ fn }) {
FILE: src/providers/monsterapi/chatComplete.ts
type MonsterAPIErrorResponse (line 60) | interface MonsterAPIErrorResponse {
FILE: src/providers/moonshot/chatComplete.ts
type MoonshotChatCompleteResponse (line 58) | interface MoonshotChatCompleteResponse extends ChatCompletionResponse {
type MoonshotErrorResponse (line 70) | interface MoonshotErrorResponse {
type MoonshotStreamChunk (line 78) | interface MoonshotStreamChunk {
FILE: src/providers/ncompass/chatComplete.ts
type NCompassErrorResponse (line 82) | interface NCompassErrorResponse {
type NCompassStreamChunk (line 90) | interface NCompassStreamChunk {
FILE: src/providers/nebius/api.ts
method headers (line 5) | headers({ providerOptions }) {
method getEndpoint (line 9) | getEndpoint({ fn }) {
FILE: src/providers/nextbit/api.ts
method headers (line 5) | headers({ providerOptions }) {
method getEndpoint (line 9) | getEndpoint({ fn }) {
FILE: src/providers/nomic/embed.ts
type NomicEmbedResponse (line 31) | interface NomicEmbedResponse {
type NomicValidationErrorResponse (line 40) | interface NomicValidationErrorResponse {
type NomicErrorResponse (line 48) | interface NomicErrorResponse {
FILE: src/providers/novita-ai/chatComplete.ts
type NovitaAIChatCompleteResponse (line 86) | interface NovitaAIChatCompleteResponse extends ChatCompletionResponse {
type NovitaAIErrorResponse (line 94) | interface NovitaAIErrorResponse {
type NovitaAIOpenAICompatibleErrorResponse (line 103) | interface NovitaAIOpenAICompatibleErrorResponse extends ErrorResponse {}
type NovitaAIChatCompletionStreamChunk (line 105) | interface NovitaAIChatCompletionStreamChunk {
FILE: src/providers/novita-ai/complete.ts
type NovitaAICompleteResponse (line 51) | interface NovitaAICompleteResponse extends CompletionResponse {
type NovitaAICompletionStreamChunk (line 59) | interface NovitaAICompletionStreamChunk {
FILE: src/providers/ollama/chatComplete.ts
type OllamaChatCompleteResponse (line 88) | interface OllamaChatCompleteResponse extends ChatCompletionResponse {
type OllamaStreamChunk (line 92) | interface OllamaStreamChunk {
FILE: src/providers/ollama/embed.ts
type OllamaEmbedResponse (line 21) | interface OllamaEmbedResponse extends EmbedResponse {
type OllamaErrorResponse (line 25) | interface OllamaErrorResponse {
FILE: src/providers/open-ai-base/constants.ts
constant RESPONSE_ERROR_EVENT (line 24) | const RESPONSE_ERROR_EVENT: ResponseErrorEvent = {
constant RESPONSE_CREATED_EVENT (line 32) | const RESPONSE_CREATED_EVENT: ResponseCreatedEvent = {
constant RESPONSE_IN_PROGRESS_EVENT (line 69) | const RESPONSE_IN_PROGRESS_EVENT: ResponseInProgressEvent = {
constant RESPONSE_OUTPUT_MESSAGE_ITEM_ADDED_EVENT (line 106) | const RESPONSE_OUTPUT_MESSAGE_ITEM_ADDED_EVENT: ResponseOutputItemAddedE...
constant RESPONSE_OUTPUT_MESSAGE_OUTPUT_TEXT_CONTENT_PART_ADDED_EVENT (line 119) | const RESPONSE_OUTPUT_MESSAGE_OUTPUT_TEXT_CONTENT_PART_ADDED_EVENT: Resp...
constant RESPONSE_OUTPUT_MESSAGE_REFUSAL_CONTENT_PART_ADDED_EVENT (line 132) | const RESPONSE_OUTPUT_MESSAGE_REFUSAL_CONTENT_PART_ADDED_EVENT: Response...
constant RESPONSE_OUTPUT_TEXT_DELTA_EVENT (line 144) | const RESPONSE_OUTPUT_TEXT_DELTA_EVENT: ResponseTextDeltaEvent = {
constant RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED_EVENT (line 152) | const RESPONSE_OUTPUT_TEXT_ANNOTATION_ADDED_EVENT: ResponseTextAnnotatio...
constant RESPONSE_OUTPUT_TEXT_DONE_EVENT (line 166) | const RESPONSE_OUTPUT_TEXT_DONE_EVENT: ResponseTextDoneEvent = {
constant RESPONSE_OUTPUT_REFUSAL_DELTA_EVENT (line 174) | const RESPONSE_OUTPUT_REFUSAL_DELTA_EVENT: ResponseRefusalDeltaEvent = {
constant RESPONSE_OUTPUT_REFUSAL_DONE_EVENT (line 182) | const RESPONSE_OUTPUT_REFUSAL_DONE_EVENT: ResponseRefusalDoneEvent = {
constant RESPONSE_OUTPUT_MESSAGE_REFUSAL_CONTENT_PART_DONE_EVENT (line 190) | const RESPONSE_OUTPUT_MESSAGE_REFUSAL_CONTENT_PART_DONE_EVENT: ResponseC...
constant RESPONSE_OUTPUT_MESSAGE_OUTPUT_TEXT_CONTENT_PART_DONE_EVENT (line 202) | const RESPONSE_OUTPUT_MESSAGE_OUTPUT_TEXT_CONTENT_PART_DONE_EVENT: Respo...
constant RESPONSE_OUTPUT_MESSAGE_ITEM_DONE_EVENT (line 216) | const RESPONSE_OUTPUT_MESSAGE_ITEM_DONE_EVENT: ResponseOutputItemDoneEve...
constant RESPONSE_OUTPUT_FUNCTION_CALL_ITEM_ADDED_EVENT (line 236) | const RESPONSE_OUTPUT_FUNCTION_CALL_ITEM_ADDED_EVENT: ResponseOutputItem...
constant RESPONSE_OUTPUT_FUNCTION_CALL_ARGUMENTS_DELTA_EVENT (line 251) | const RESPONSE_OUTPUT_FUNCTION_CALL_ARGUMENTS_DELTA_EVENT: ResponseFunct...
constant RESPONSE_OUTPUT_FUNCTION_CALL_ARGUMENTS_DONE_EVENT (line 260) | const RESPONSE_OUTPUT_FUNCTION_CALL_ARGUMENTS_DONE_EVENT: ResponseFuncti...
constant RESPONSE_OUTPUT_FUNCTION_CALL_ITEM_DONE_EVENT (line 269) | const RESPONSE_OUTPUT_FUNCTION_CALL_ITEM_DONE_EVENT: ResponseOutputItemD...
constant RESPONSE_OUTPUT_WEB_SEARCH_ITEM_ADDED_EVENT (line 284) | const RESPONSE_OUTPUT_WEB_SEARCH_ITEM_ADDED_EVENT: ResponseOutputItemAdd...
constant RESPONSE_OUTPUT_WEB_SEARCH_CALL_IN_PROGRESS_EVENT (line 296) | const RESPONSE_OUTPUT_WEB_SEARCH_CALL_IN_PROGRESS_EVENT: ResponseWebSear...
constant RESPONSE_OUTPUT_WEB_SEARCH_CALL_SEARCHING_EVENT (line 304) | const RESPONSE_OUTPUT_WEB_SEARCH_CALL_SEARCHING_EVENT: ResponseWebSearch...
constant RESPONSE_OUTPUT_WEB_SEARCH_CALL_COMPLETED_EVENT (line 312) | const RESPONSE_OUTPUT_WEB_SEARCH_CALL_COMPLETED_EVENT: ResponseWebSearch...
constant RESPONSE_OUTPUT_WEB_SEARCH_ITEM_DONE_EVENT (line 319) | const RESPONSE_OUTPUT_WEB_SEARCH_ITEM_DONE_EVENT: ResponseOutputItemDone...
constant RESPONSE_OUTPUT_FILE_SEARCH_ITEM_ADDED_EVENT (line 330) | const RESPONSE_OUTPUT_FILE_SEARCH_ITEM_ADDED_EVENT: ResponseOutputItemAd...
constant RESPONSE_OUTPUT_FILE_SEARCH_CALL_IN_PROGRESS_EVENT (line 343) | const RESPONSE_OUTPUT_FILE_SEARCH_CALL_IN_PROGRESS_EVENT: ResponseFileSe...
constant RESPONSE_OUTPUT_FILE_SEARCH_CALL_SEARCHING_EVENT (line 350) | const RESPONSE_OUTPUT_FILE_SEARCH_CALL_SEARCHING_EVENT: ResponseFileSear...
constant RESPONSE_OUTPUT_FILE_SEARCH_CALL_COMPLETED_EVENT (line 357) | const RESPONSE_OUTPUT_FILE_SEARCH_CALL_COMPLETED_EVENT: ResponseFileSear...
constant RESPONSE_OUTPUT_FILE_SEARCH_ITEM_DONE_EVENT (line 364) | const RESPONSE_OUTPUT_FILE_SEARCH_ITEM_DONE_EVENT: ResponseOutputItemDon...
constant RESPONSE_OUTPUT_COMPUTER_CALL_ITEM_ADDED_EVENT (line 377) | const RESPONSE_OUTPUT_COMPUTER_CALL_ITEM_ADDED_EVENT: ResponseOutputItem...
constant RESPONSE_OUTPUT_COMPUTER_CALL_ITEM_DONE_EVENT (line 391) | const RESPONSE_OUTPUT_COMPUTER_CALL_ITEM_DONE_EVENT: ResponseOutputItemD...
constant RESPONSE_OUTPUT_REASONING_ITEM_ADDED_EVENT (line 405) | const RESPONSE_OUTPUT_REASONING_ITEM_ADDED_EVENT: ResponseOutputItemAdde...
constant RESPONSE_OUTPUT_REASONING_ITEM_DONE_EVENT (line 416) | const RESPONSE_OUTPUT_REASONING_ITEM_DONE_EVENT: ResponseOutputItemDoneE...
FILE: src/providers/open-ai-base/index.ts
type CustomTransformer (line 18) | type CustomTransformer<T, U> = (
type DefaultValues (line 23) | type DefaultValues = {
FILE: src/providers/openai/chatComplete.ts
type OpenAIChatCompleteResponse (line 135) | interface OpenAIChatCompleteResponse extends ChatCompletionResponse {
FILE: src/providers/openai/complete.ts
type OpenAICompleteResponse (line 83) | interface OpenAICompleteResponse extends CompletionResponse {
FILE: src/providers/openai/embed.ts
type OpenAIEmbedResponse (line 29) | interface OpenAIEmbedResponse extends EmbedResponse {}
FILE: src/providers/openai/imageGenerate.ts
type OpenAIImageObject (line 37) | interface OpenAIImageObject {
type OpenAIImageGenerateResponse (line 43) | interface OpenAIImageGenerateResponse extends ImageGenerateResponse {
FILE: src/providers/openrouter/chatComplete.ts
type OpenrouterUsageDetails (line 104) | interface OpenrouterUsageDetails {
type OpenrouterChatCompleteResponse (line 121) | interface OpenrouterChatCompleteResponse extends ChatCompletionResponse {
type OpenrouterErrorResponse (line 135) | interface OpenrouterErrorResponse {
type OpenrouterStreamChunk (line 143) | interface OpenrouterStreamChunk {
FILE: src/providers/openrouter/utils.ts
type OpenrouterUsageParam (line 3) | interface OpenrouterUsageParam {
type OpenRouterParams (line 7) | interface OpenRouterParams extends Params {
type OpenrouterReasoningParam (line 15) | type OpenrouterReasoningParam = {
FILE: src/providers/oracle/types/ChatDetails.ts
type OracleMessageRole (line 10) | type OracleMessageRole =
type ChatDetails (line 17) | interface ChatDetails {
type ServingMode (line 26) | interface ServingMode {
type DedicatedServingMode (line 30) | interface DedicatedServingMode extends ServingMode {
type OnDemandServingMode (line 39) | interface OnDemandServingMode extends ServingMode {
type ChatContent (line 48) | interface ChatContent {
type Message (line 53) | interface Message {
type StreamOptions (line 62) | interface StreamOptions {
type TextContent (line 70) | interface TextContent extends ChatContent {
type Prediction (line 79) | interface Prediction {
type StaticContent (line 83) | interface StaticContent extends Prediction {
type ResponseFormat (line 93) | interface ResponseFormat {
type TextResponseFormat (line 97) | interface TextResponseFormat extends ResponseFormat {
type JsonObjectResponseFormat (line 101) | interface JsonObjectResponseFormat extends ResponseFormat {
type ResponseJsonSchema (line 105) | interface ResponseJsonSchema {
type JsonSchemaResponseFormat (line 125) | interface JsonSchemaResponseFormat extends ResponseFormat {
type ToolChoice (line 131) | interface ToolChoice {
type ToolChoiceFunction (line 135) | interface ToolChoiceFunction extends ToolChoice {
type ToolChoiceNone (line 144) | interface ToolChoiceNone extends ToolChoice {
type ToolChoiceAuto (line 148) | interface ToolChoiceAuto extends ToolChoice {
type ToolChoiceRequired (line 152) | interface ToolChoiceRequired extends ToolChoice {
type ToolDefinition (line 156) | interface ToolDefinition {
type ApproximateLocation (line 163) | interface ApproximateLocation {
type WebSearchOptions (line 182) | interface WebSearchOptions {
type SearchContextSize (line 195) | type SearchContextSize = 'HIGH' | 'MEDIUM' | 'LOW';
type BaseChatRequest (line 198) | interface BaseChatRequest {
type GenericChatRequest (line 202) | interface GenericChatRequest extends BaseChatRequest {
type ReasoningEffort (line 330) | type ReasoningEffort = 'minimal' | 'low' | 'medium' | 'high';
type Verbosity (line 331) | type Verbosity = number;
type ServiceTier (line 332) | type ServiceTier = string;
type CohereMessage (line 335) | interface CohereMessage {
type CohereResponseFormat (line 339) | interface CohereResponseFormat {
type CohereResponseTextFormat (line 343) | interface CohereResponseTextFormat extends CohereResponseFormat {
type CohereResponseJsonFormat (line 347) | interface CohereResponseJsonFormat extends CohereResponseFormat {
type CohereParameterDefinition (line 356) | interface CohereParameterDefinition {
type CohereTool (line 362) | interface CohereTool {
type CohereToolCall (line 377) | interface CohereToolCall {
type CohereToolResult (line 388) | interface CohereToolResult {
type CohereChatRequest (line 396) | interface CohereChatRequest extends BaseChatRequest {
type PromptTruncation (line 530) | type PromptTruncation = 'AUTO_PRESERVE_ORDER' | 'OFF';
type CitationQuality (line 531) | type CitationQuality = 'FAST' | 'ACCURATE';
type SafetyMode (line 532) | type SafetyMode = 'CONTEXTUAL' | 'STRICT' | 'OFF';
function getJsonObj (line 536) | function getJsonObj(obj: ChatDetails): object {
function getDeserializedJsonObj (line 547) | function getDeserializedJsonObj(obj: ChatDetails): object {
FILE: src/providers/oracle/types/GenericChatResponse.ts
type OracleErrorResponse (line 7) | interface OracleErrorResponse {
type OracleChatCompleteResponse (line 12) | interface OracleChatCompleteResponse {
type GenericChatResponse (line 19) | interface GenericChatResponse {
type ChatContent (line 37) | interface ChatContent {
type Message (line 42) | interface Message {
type SystemMessage (line 51) | interface SystemMessage extends Message {
type ToolCall (line 60) | interface ToolCall {
type UrlCitation (line 71) | interface UrlCitation {
type Annotation (line 90) | interface Annotation {
type AssistantMessage (line 98) | interface AssistantMessage extends Message {
type UserMessage (line 119) | interface UserMessage extends Message {
type ToolMessage (line 128) | interface ToolMessage extends Message {
type DeveloperMessage (line 137) | interface DeveloperMessage extends Message {
type Logprobs (line 146) | interface Logprobs {
type CompletionTokensDetails (line 165) | interface CompletionTokensDetails {
type PromptTokensDetails (line 185) | interface PromptTokensDetails {
type Usage (line 196) | interface Usage {
type SearchEntryPoint (line 213) | interface SearchEntryPoint {
type GroundingWebChunk (line 220) | interface GroundingWebChunk {
type GroundingChunk (line 235) | interface GroundingChunk {
type GroundingSupportSegment (line 239) | interface GroundingSupportSegment {
type GroundingSupport (line 254) | interface GroundingSupport {
type GroundingMetadata (line 262) | interface GroundingMetadata {
type ChatChoice (line 278) | interface ChatChoice {
function getJsonObj (line 306) | function getJsonObj(
function getDeserializedJsonObj (line 321) | function getDeserializedJsonObj(
FILE: src/providers/oracle/utils.ts
type OCIConfig (line 28) | interface OCIConfig {
type SigningHeaders (line 37) | interface SigningHeaders {
class OCIRequestSigner (line 41) | class OCIRequestSigner {
method constructor (line 45) | constructor(config: OCIConfig) {
method signRequest (line 60) | public async signRequest(
FILE: src/providers/ovhcloud/api.ts
constant DEFAULT_OVHCLOUD_BASE_URL (line 3) | const DEFAULT_OVHCLOUD_BASE_URL =
FILE: src/providers/ovhcloud/chatComplete.ts
type OVHcloudStreamChunk (line 15) | interface OVHcloudStreamChunk {
FILE: src/providers/palm/embed.ts
type embedding (line 21) | interface embedding {
type PalmEmbedResponse (line 25) | interface PalmEmbedResponse {
FILE: src/providers/perplexity-ai/chatComplete.ts
type PerplexityAIChatChoice (line 91) | interface PerplexityAIChatChoice {
type PerplexityAIChatCompleteResponse (line 104) | interface PerplexityAIChatCompleteResponse {
type PerplexityAIErrorResponse (line 118) | interface PerplexityAIErrorResponse {
type PerplexityAIChatCompletionStreamChunk (line 126) | interface PerplexityAIChatCompletionStreamChunk {
FILE: src/providers/predibase/chatComplete.ts
type PredibaseChatCompleteResponse (line 96) | interface PredibaseChatCompleteResponse extends ChatCompletionResponse {
type PredibaseErrorResponse (line 108) | interface PredibaseErrorResponse extends ErrorResponse {}
type PredibaseChatChoice (line 150) | interface PredibaseChatChoice {
type PredibaseChatCompletionStreamChunk (line 163) | interface PredibaseChatCompletionStreamChunk {
FILE: src/providers/recraft-ai/imageGenerate.ts
type RecraftAIImageObject (line 5) | interface RecraftAIImageObject {
type RecraftAIImageGenerateResponse (line 10) | interface RecraftAIImageGenerateResponse extends ImageGenerateResponse {
FILE: src/providers/reka-ai/chatComplete.ts
type RekaMessageItem (line 13) | interface RekaMessageItem {
type RekaAIChatCompleteResponse (line 134) | interface RekaAIChatCompleteResponse {
type RekaAIErrorResponse (line 144) | interface RekaAIErrorResponse {
FILE: src/providers/sambanova/chatComplete.ts
type SambaNovaStreamChunk (line 3) | interface SambaNovaStreamChunk {
FILE: src/providers/segmind/imageGenerate.ts
type SegmindImageGenerateResponse (line 101) | interface SegmindImageGenerateResponse {
type SegmindImageGenerateErrorResponse (line 107) | interface SegmindImageGenerateErrorResponse {
FILE: src/providers/siliconflow/embed.ts
type SiliconFlowEmbedResponse (line 23) | interface SiliconFlowEmbedResponse extends EmbedResponse {}
FILE: src/providers/siliconflow/imageGenerate.ts
type SiliconFlowImageObject (line 28) | interface SiliconFlowImageObject {
type SiliconFlowImageGenerateResponse (line 34) | interface SiliconFlowImageGenerateResponse extends ImageGenerateResponse {
FILE: src/providers/stability-ai/constants.ts
constant STABILITY_V1_MODELS (line 1) | const STABILITY_V1_MODELS = [
FILE: src/providers/stability-ai/imageGenerate.ts
type StabilityAIImageGenerateV1Response (line 63) | interface StabilityAIImageGenerateV1Response extends ImageGenerateRespon...
type StabilityAIImageGenerateV1ErrorResponse (line 67) | interface StabilityAIImageGenerateV1ErrorResponse {
type ImageArtifact (line 73) | interface ImageArtifact {
FILE: src/providers/stability-ai/imageGenerateV2.ts
type StabilityAIIMageGenerateV2FinishReason (line 47) | enum StabilityAIIMageGenerateV2FinishReason {
type StabilityAIIMageGenerateV2Response (line 52) | interface StabilityAIIMageGenerateV2Response {
type StabilityAIIMageGenerateV2ErrorResponse (line 58) | interface StabilityAIIMageGenerateV2ErrorResponse {
FILE: src/providers/together-ai/chatComplete.ts
type TogetherAIChatCompleteResponse (line 78) | interface TogetherAIChatCompleteResponse extends ChatCompletionResponse {
type TogetherAIErrorResponse (line 86) | interface TogetherAIErrorResponse {
type TogetherAIOpenAICompatibleErrorResponse (line 95) | interface TogetherAIOpenAICompatibleErrorResponse
type TogetherAIChatCompletionStreamChunk (line 98) | interface TogetherAIChatCompletionStreamChunk {
FILE: src/providers/together-ai/complete.ts
type TogetherAICompleteResponse (line 51) | interface TogetherAICompleteResponse extends CompletionResponse {
type TogetherAICompletionStreamChunk (line 59) | interface TogetherAICompletionStreamChunk {
FILE: src/providers/together-ai/embed.ts
type TogetherAIEmbedResponse (line 29) | interface TogetherAIEmbedResponse extends EmbedResponse {}
FILE: src/providers/together-ai/types.ts
type TOGETHER_AI_FINISH_REASON (line 1) | enum TOGETHER_AI_FINISH_REASON {
FILE: src/providers/triton/complete.ts
type TritonCompleteResponse (line 41) | interface TritonCompleteResponse extends CompletionResponse {
type TritonErrorResponse (line 52) | interface TritonErrorResponse {
FILE: src/providers/types.ts
type ParameterConfig (line 19) | interface ParameterConfig {
type ProviderConfig (line 38) | interface ProviderConfig {
type ProviderAPIConfig (line 47) | interface ProviderAPIConfig {
type endpointStrings (line 85) | type endpointStrings =
type ProviderAPIConfigs (line 126) | interface ProviderAPIConfigs {
type RequestHandler (line 131) | type RequestHandler<
type RequestHandlers (line 141) | type RequestHandlers = Partial<
type ProviderConfigs (line 149) | interface ProviderConfigs {
type BaseResponse (line 162) | interface BaseResponse {
type CResponse (line 171) | interface CResponse extends BaseResponse {
type CompletionResponse (line 201) | interface CompletionResponse extends CResponse {
type GroundingMetadata (line 210) | interface GroundingMetadata {
type ChatChoice (line 233) | interface ChatChoice {
type Logprobs (line 241) | interface Logprobs {
type ChatCompletionResponse (line 256) | interface ChatCompletionResponse extends CResponse {
type ErrorResponse (line 266) | interface ErrorResponse {
type ImageGenerateResponse (line 280) | interface ImageGenerateResponse {
type UploadFileResponse (line 290) | interface UploadFileResponse extends File {}
type GetFileResponse (line 296) | interface GetFileResponse extends File {}
type GetFilesResponse (line 302) | interface GetFilesResponse {
type File (line 311) | interface File {
type DeleteFileResponse (line 334) | interface DeleteFileResponse {
type Batch (line 340) | interface Batch {
type CreateBatchResponse (line 377) | interface CreateBatchResponse extends Batch {}
type RetrieveBatchResponse (line 378) | interface RetrieveBatchResponse extends Batch {}
type CancelBatchResponse (line 379) | interface CancelBatchResponse extends Batch {}
type ListBatchesResponse (line 380) | interface ListBatchesResponse {
type FinetuneProviderOptions (line 385) | interface FinetuneProviderOptions {
type FinetuneRequest (line 391) | interface FinetuneRequest {
type CreateBatchRequest (line 423) | interface CreateBatchRequest {
type StreamContentBlock (line 429) | interface StreamContentBlock {
type FINISH_REASON (line 439) | enum FINISH_REASON {
type PROVIDER_FINISH_REASON (line 447) | type PROVIDER_FINISH_REASON =
FILE: src/providers/upstage/api.ts
method headers (line 5) | headers({ providerOptions }) {
method getEndpoint (line 9) | getEndpoint({ fn }) {
FILE: src/providers/utils.ts
type SplitResult (line 45) | type SplitResult = {
function splitString (line 50) | function splitString(input: string, separator: string): SplitResult {
FILE: src/providers/voyage/embed.ts
type VoyageEmbedResponse (line 42) | interface VoyageEmbedResponse {
type VoyageValidationErrorResponse (line 51) | interface VoyageValidationErrorResponse {
FILE: src/providers/workers-ai/chatComplete.ts
type WorkersAiChatCompleteResponse (line 40) | interface WorkersAiChatCompleteResponse {
type WorkersAiChatCompleteStreamResponse (line 49) | interface WorkersAiChatCompleteStreamResponse {
FILE: src/providers/workers-ai/complete.ts
type WorkersAiCompleteResponse (line 28) | interface WorkersAiCompleteResponse {
type WorkersAiCompleteStreamResponse (line 37) | interface WorkersAiCompleteStreamResponse {
FILE: src/providers/workers-ai/embed.ts
type WorkersAiEmbedResponse (line 28) | interface WorkersAiEmbedResponse {
FILE: src/providers/workers-ai/imageGenerate.ts
type WorkersAiImageGenerateResponse (line 9) | interface WorkersAiImageGenerateResponse extends ImageGenerateResponse {
FILE: src/providers/workers-ai/utils.ts
type WorkersAiErrorResponse (line 5) | interface WorkersAiErrorResponse {
type WorkersAiErrorObject (line 10) | interface WorkersAiErrorObject {
FILE: src/providers/x-ai/index.ts
type XAIErrorResponse (line 11) | interface XAIErrorResponse {
FILE: src/providers/zhipu/chatComplete.ts
type ZhipuChatCompleteResponse (line 52) | interface ZhipuChatCompleteResponse extends ChatCompletionResponse {
type ZhipuErrorResponse (line 64) | interface ZhipuErrorResponse {
type ZhipuStreamChunk (line 72) | interface ZhipuStreamChunk {
FILE: src/providers/zhipu/embed.ts
type ZhipuEmbedResponse (line 18) | interface ZhipuEmbedResponse extends EmbedResponse {}
FILE: src/services/conditionalRouter.ts
type Query (line 3) | type Query = {
type RouterContext (line 7) | interface RouterContext {
type Operator (line 15) | enum Operator {
class ConditionalRouter (line 32) | class ConditionalRouter {
method constructor (line 36) | constructor(config: Targets, context: RouterContext) {
method resolveTarget (line 44) | resolveTarget(): Targets {
method evaluateQuery (line 64) | private evaluateQuery(query: Query): boolean {
method evaluateOperator (line 92) | private evaluateOperator(operator: string, value: any): boolean {
method findTarget (line 137) | private findTarget(name: string): Targets {
method getContextValue (line 150) | private getContextValue(key: string): any {
FILE: src/services/realtimeLlmEventParser.ts
class RealtimeLlmEventParser (line 4) | class RealtimeLlmEventParser {
method constructor (line 7) | constructor() {
method handleEvent (line 18) | handleEvent(c: Context, event: any, sessionOptions: any): void {
method handleSessionCreated (line 44) | private handleSessionCreated(
method handleSessionUpdated (line 66) | private handleSessionUpdated(
method handleConversationItemCreated (line 88) | private handleConversationItemCreated(c: Context, data: any): void {
method handleConversationItemDeleted (line 93) | private handleConversationItemDeleted(c: Context, data: any): void {
method handleResponseDone (line 97) | private handleResponseDone(c: Context, data: any, sessionOptions: any)...
method handleError (line 132) | private handleError(c: Context, data: any, sessionOptions: any): void {
method rebuildConversationSequence (line 142) | private rebuildConversationSequence(items: Map<string, any>): string[] {
method getOrderedConversationItems (line 162) | private getOrderedConversationItems(sequence: string[]): any {
FILE: src/services/transformToProviderRequest.ts
function setNestedProperty (line 16) | function setNestedProperty(obj: any, path: string, value: any) {
FILE: src/shared/services/cache/backends/cloudflareKV.ts
type ICloudflareKVClient (line 21) | interface ICloudflareKVClient {
class CloudflareKVCacheBackend (line 28) | class CloudflareKVCacheBackend implements CacheBackend {
method constructor (line 41) | constructor(client: ICloudflareKVClient, dbName: string) {
method getFullKey (line 46) | private getFullKey(key: string, namespace?: string): string {
method serializeEntry (line 52) | private serializeEntry<T>(entry: CacheEntry<T>): string {
method deserializeEntry (line 56) | private deserializeEntry<T>(data: string): CacheEntry<T> {
method get (line 60) | async get<T = any>(
method set (line 84) | async set<T = any>(
method delete (line 111) | async delete(key: string, namespace?: string): Promise<boolean> {
method clear (line 128) | async clear(namespace?: string): Promise<void> {
method keys (line 132) | async keys(namespace?: string): Promise<string[]> {
method getStats (line 144) | async getStats(namespace?: string): Promise<CacheStats> {
method has (line 159) | async has(key: string, namespace?: string): Promise<boolean> {
method cleanup (line 164) | async cleanup(): Promise<void> {
method close (line 172) | async close(): Promise<void> {
class CloudflareKVClient (line 178) | class CloudflareKVClient implements ICloudflareKVClient {
method constructor (line 181) | constructor(env: any, kvBindingName: string) {
function createCloudflareKVBackend (line 223) | function createCloudflareKVBackend(
FILE: src/shared/services/cache/backends/file.ts
type FileCacheData (line 22) | interface FileCacheData {
class FileCacheBackend (line 28) | class FileCacheBackend implements CacheBackend {
method constructor (line 44) | constructor(
method ensureLoaded (line 59) | private async ensureLoaded(): Promise<void> {
method ensureDataDir (line 65) | private async ensureDataDir(): Promise<void> {
method loadCache (line 74) | private async loadCache(): Promise<void> {
method saveCache (line 88) | private async saveCache(): Promise<void> {
method scheduleSave (line 98) | private scheduleSave(): void {
method startCleanup (line 109) | private startCleanup(intervalMs: number): void {
method isExpired (line 115) | private isExpired(entry: CacheEntry): boolean {
method updateStats (line 119) | private updateStats(): void {
method getNamespaceData (line 136) | private getNamespaceData(
method get (line 145) | async get<T = any>(
method set (line 171) | async set<T = any>(
method delete (line 195) | async delete(key: string, namespace?: string): Promise<boolean> {
method clear (line 209) | async clear(namespace?: string): Promise<void> {
method has (line 228) | async has(key: string, namespace?: string): Promise<boolean> {
method keys (line 244) | async keys(namespace?: string): Promise<string[]> {
method getStats (line 257) | async getStats(namespace?: string): Promise<CacheStats> {
method cleanup (line 281) | async cleanup(): Promise<void> {
method waitForReady (line 304) | async waitForReady(): Promise<void> {
method close (line 308) | async close(): Promise<void> {
FILE: src/shared/services/cache/backends/memory.ts
class MemoryCacheBackend (line 19) | class MemoryCacheBackend implements CacheBackend {
method constructor (line 32) | constructor(maxSize: number = 10000, cleanupIntervalMs: number = 60000) {
method startCleanup (line 37) | private startCleanup(intervalMs: number): void {
method getFullKey (line 43) | private getFullKey(key: string, namespace?: string): string {
method isExpired (line 47) | private isExpired(entry: CacheEntry): boolean {
method evictIfNeeded (line 51) | private evictIfNeeded(): void {
method get (line 66) | async get<T = any>(
method set (line 89) | async set<T = any>(
method delete (line 110) | async delete(key: string, namespace?: string): Promise<boolean> {
method clear (line 122) | async clear(namespace?: string): Promise<void> {
method has (line 142) | async has(key: string, namespace?: string): Promise<boolean> {
method keys (line 157) | async keys(namespace?: string): Promise<string[]> {
method getStats (line 170) | async getStats(namespace?: string): Promise<CacheStats> {
method cleanup (line 195) | async cleanup(): Promise<void> {
method close (line 212) | async close(): Promise<void> {
FILE: src/shared/services/cache/backends/redis.ts
type RedisClient (line 9) | type RedisClient = Redis;
class RedisCacheBackend (line 23) | class RedisCacheBackend implements CacheBackend {
method constructor (line 36) | constructor(client: RedisClient, dbName: string) {
method serializeEntry (line 41) | private serializeEntry<T>(entry: CacheEntry<T>): string {
method deserializeEntry (line 45) | private deserializeEntry<T>(data: string): CacheEntry<T> {
method isExpired (line 49) | private isExpired(entry: CacheEntry): boolean {
method getFullKey (line 53) | getFullKey(key: string, namespace?: string): string {
method get (line 59) | async get<T = any>(
method set (line 91) | async set<T = any>(
method delete (line 124) | async delete(key: string, namespace?: string): Promise<boolean> {
method clear (line 141) | async clear(namespace?: string): Promise<void> {
method has (line 159) | async has(key: string, namespace?: string): Promise<boolean> {
method keys (line 170) | async keys(namespace?: string): Promise<string[]> {
method getStats (line 188) | async getStats(namespace?: string): Promise<CacheStats> {
method script (line 205) | async script(mode: 'LOAD' | 'EXISTS', script: string): Promise<unknown> {
method evalsha (line 209) | async evalsha(sha: string, keys: string[], args: string[]): Promise<un...
method cleanup (line 213) | async cleanup(): Promise<void> {
method close (line 219) | async close(): Promise<void> {
function createRedisBackend (line 230) | function createRedisBackend(
FILE: src/shared/services/cache/index.ts
class CacheService (line 42) | class CacheService {
method constructor (line 46) | constructor(config: CacheConfig) {
method createBackend (line 51) | private createBackend(config: CacheConfig): CacheBackend {
method get (line 93) | async get<T = any>(key: string, namespace?: string): Promise<T | null> {
method getEntry (line 101) | async getEntry<T = any>(
method set (line 111) | async set<T = any>(
method setWithTtl (line 127) | async setWithTtl<T = any>(
method delete (line 142) | async delete(key: string, namespace?: string): Promise<boolean> {
method has (line 149) | async has(key: string, namespace?: string): Promise<boolean> {
method keys (line 156) | async keys(namespace?: string): Promise<string[]> {
method clear (line 163) | async clear(namespace?: string): Promise<void> {
method getStats (line 170) | async getStats(namespace?: string): Promise<CacheStats> {
method cleanup (line 177) | async cleanup(): Promise<void> {
method waitForReady (line 184) | async waitForReady(): Promise<void> {
method close (line 193) | async close(): Promise<void> {
method getOrSet (line 200) | async getOrSet<T = any>(
method increment (line 218) | async increment(
method setMany (line 233) | async setMany<T = any>(
method getMany (line 246) | async getMany<T = any>(
method getClient (line 257) | getClient(): CacheBackend {
function getDefaultCache (line 273) | function getDefaultCache(): CacheService {
function getTokenCache (line 283) | function getTokenCache(): CacheService {
function getSessionCache (line 293) | function getSessionCache(): CacheService {
function getTokenIntrospectionCache (line 303) | function getTokenIntrospectionCache(): CacheService {
function getConfigCache (line 311) | function getConfigCache(): CacheService {
function getOauthStore (line 321) | function getOauthStore(): CacheService {
function getMcpServersCache (line 328) | function getMcpServersCache(): CacheService {
function initializeCache (line 338) | function initializeCache(config: CacheConfig): CacheService {
function createCacheBackendsLocal (line 342) | async function createCacheBackendsLocal(): Promise<void> {
function createCacheBackendsRedis (line 394) | function createCacheBackendsRedis(redisUrl: string): void {
function createCacheBackendsCF (line 440) | function createCacheBackendsCF(env: any): void {
FILE: src/shared/services/cache/types.ts
type CacheEntry (line 6) | interface CacheEntry<T = any> {
type CacheOptions (line 13) | interface CacheOptions {
type CacheStats (line 19) | interface CacheStats {
type CacheBackend (line 28) | interface CacheBackend {
type CacheConfig (line 40) | interface CacheConfig {
FILE: src/shared/services/cache/utils/rateLimiter.ts
constant RATE_LIMIT_LUA (line 5) | const RATE_LIMIT_LUA = `
class RedisRateLimiter (line 84) | class RedisRateLimiter {
method constructor (line 95) | constructor(
method loadOrGetScriptSha (line 115) | private async loadOrGetScriptSha(): Promise<string> {
method executeScript (line 125) | private async executeScript(keys: string[], args: string[]): Promise<a...
method checkRateLimit (line 141) | async checkRateLimit(
method getToken (line 174) | async getToken(): Promise<string | null> {
method decrementToken (line 179) | async decrementToken(
FILE: src/shared/utils/logger.ts
type LogLevel (line 6) | enum LogLevel {
type LoggerConfig (line 14) | interface LoggerConfig {
class Logger (line 21) | class Logger {
method constructor (line 32) | constructor(config: LoggerConfig) {
method formatMessage (line 40) | private formatMessage(level: string, message: string): string {
method log (line 57) | private log(level: LogLevel, levelName: string, message: string, data?...
method error (line 73) | error(message: string, error?: Error | any) {
method critical (line 86) | critical(message: string, data?: any) {
method warn (line 90) | warn(message: string, data?: any) {
method info (line 94) | info(message: string, data?: any) {
method debug (line 98) | debug(message: string, data?: any) {
method createChild (line 102) | createChild(prefix: string): Logger {
function createLogger (line 126) | function createLogger(prefix: string): Logger {
FILE: src/start-server.ts
function sendWithTimeout (line 61) | async function sendWithTimeout(fn: () => Promise<void>, timeoutMs = 200) {
function showLoadingAnimation (line 156) | async function showLoadingAnimation() {
FILE: src/tests/resources/constants.ts
constant CHAT_COMPLETIONS_ENDPOINT (line 2) | const CHAT_COMPLETIONS_ENDPOINT = `${baseURL}/v1/chat/completions`;
FILE: src/tests/resources/requestTemplates.ts
constant CHAT_COMPLETE_WITH_MESSAGE_CONTENT_ARRAYS_REQUEST (line 3) | const CHAT_COMPLETE_WITH_MESSAGE_CONTENT_ARRAYS_REQUEST: Params = {
constant CHAT_COMPLETE_WITH_MESSAGE_STRING_REQUEST (line 33) | const CHAT_COMPLETE_WITH_MESSAGE_STRING_REQUEST: Params = {
FILE: src/tests/resources/testVariables.ts
type TestVariable (line 3) | interface TestVariable {
type TestVariables (line 10) | interface TestVariables {
FILE: src/types/MessagesRequest.ts
type CacheControlEphemeral (line 1) | interface CacheControlEphemeral {
type ServerToolUseBlockParam (line 5) | interface ServerToolUseBlockParam {
type WebSearchResultBlockParam (line 20) | interface WebSearchResultBlockParam {
type WebSearchToolRequestError (line 32) | interface WebSearchToolRequestError {
type WebSearchToolResultBlockParamContent (line 43) | type WebSearchToolResultBlockParamContent =
type WebSearchToolResultBlockParam (line 47) | interface WebSearchToolResultBlockParam {
type CitationCharLocationParam (line 60) | interface CitationCharLocationParam {
type CitationPageLocationParam (line 74) | interface CitationPageLocationParam {
type CitationContentBlockLocationParam (line 88) | interface CitationContentBlockLocationParam {
type CitationWebSearchResultLocationParam (line 102) | interface CitationWebSearchResultLocationParam {
type TextCitationParam (line 114) | type TextCitationParam =
type TextBlockParam (line 120) | interface TextBlockParam {
type Base64ImageSource (line 133) | interface Base64ImageSource {
type URLImageSource (line 141) | interface URLImageSource {
type FileImageSource (line 149) | interface FileImageSource {
type ImageBlockParam (line 155) | interface ImageBlockParam {
type ToolUseBlockParam (line 166) | interface ToolUseBlockParam {
type ToolResultBlockParam (line 181) | interface ToolResultBlockParam {
type Base64PDFSource (line 196) | interface Base64PDFSource {
type PlainTextSource (line 204) | interface PlainTextSource {
type ContentBlockSource (line 212) | interface ContentBlockSource {
type ContentBlockSourceContent (line 218) | type ContentBlockSourceContent = TextBlockParam | ImageBlockParam;
type URLPDFSource (line 220) | interface URLPDFSource {
type CitationsConfigParam (line 228) | interface CitationsConfigParam {
type DocumentBlockParam (line 232) | interface DocumentBlockParam {
type ThinkingBlockParam (line 249) | interface ThinkingBlockParam {
type RedactedThinkingBlockParam (line 257) | interface RedactedThinkingBlockParam {
type BetaCodeExecutionToolResultErrorCode (line 263) | type BetaCodeExecutionToolResultErrorCode =
type BetaCodeExecutionToolResultErrorParam (line 269) | interface BetaCodeExecutionToolResultErrorParam {
type BetaCodeExecutionOutputBlockParam (line 275) | interface BetaCodeExecutionOutputBlockParam {
type BetaCodeExecutionResultBlockParam (line 281) | interface BetaCodeExecutionResultBlockParam {
type BetaCodeExecutionToolResultBlockParamContent (line 293) | type BetaCodeExecutionToolResultBlockParamContent =
type BetaCodeExecutionToolResultBlockParam (line 297) | interface BetaCodeExecutionToolResultBlockParam {
type ContentBlockParam (line 313) | type ContentBlockParam =
type MessageParam (line 325) | interface MessageParam {
type Metadata (line 331) | interface Metadata {
type ThinkingConfigEnabled (line 338) | interface ThinkingConfigEnabled {
type ThinkingConfigDisabled (line 347) | interface ThinkingConfigDisabled {
type ThinkingConfigParam (line 351) | type ThinkingConfigParam =
type ToolChoiceAny (line 358) | interface ToolChoiceAny {
type ToolChoiceAuto (line 373) | interface ToolChoiceAuto {
type ToolChoiceNone (line 388) | interface ToolChoiceNone {
type ToolChoiceTool (line 395) | interface ToolChoiceTool {
type ToolInputSchema (line 412) | interface ToolInputSchema {
type Tool (line 422) | interface Tool {
type ToolBash20250124 (line 477) | interface ToolBash20250124 {
type ToolTextEditor20250124 (line 493) | interface ToolTextEditor20250124 {
type WebSearchUserLocation (line 509) | interface WebSearchUserLocation {
type WebSearchTool20250305 (line 535) | interface WebSearchTool20250305 {
type TextEditor20250429 (line 574) | interface TextEditor20250429 {
type ToolSearchToolRegex (line 595) | interface ToolSearchToolRegex {
type ToolSearchToolBM25 (line 614) | interface ToolSearchToolBM25 {
type CodeExecutionTool (line 633) | interface CodeExecutionTool {
type MCPToolConfig (line 650) | interface MCPToolConfig {
type MCPToolset (line 667) | interface MCPToolset {
type ToolUnion (line 691) | type ToolUnion =
type ToolChoice (line 706) | type ToolChoice =
type MessageCreateParamsBase (line 712) | interface MessageCreateParamsBase {
FILE: src/types/MessagesStreamResponse.ts
type RawMessageStartEvent (line 17) | interface RawMessageStartEvent {
type RawMessageDelta (line 23) | interface RawMessageDelta {
type RawMessageDeltaEvent (line 29) | interface RawMessageDeltaEvent {
type RawMessageStopEvent (line 40) | interface RawMessageStopEvent {
type RawContentBlockStartEvent (line 44) | interface RawContentBlockStartEvent {
type TextDelta (line 58) | interface TextDelta {
type InputJSONDelta (line 64) | interface InputJSONDelta {
type CitationsDelta (line 70) | interface CitationsDelta {
type ThinkingDelta (line 80) | interface ThinkingDelta {
type SignatureDelta (line 86) | interface SignatureDelta {
type RawContentBlockDelta (line 92) | type RawContentBlockDelta =
type RawContentBlockDeltaEvent (line 99) | interface RawContentBlockDeltaEvent {
type RawContentBlockStopEvent (line 107) | interface RawContentBlockStopEvent {
type RawPingEvent (line 113) | interface RawPingEvent {
type RawMessageStreamEvent (line 117) | type RawMessageStreamEvent =
FILE: src/types/embedRequestBody.ts
type EmbedInput (line 4) | type EmbedInput = {
type EmbedParams (line 21) | interface EmbedParams {
type EmbedRequestBody (line 28) | interface EmbedRequestBody {
type EmbedResponseData (line 39) | interface EmbedResponseData {
type EmbedResponse (line 51) | interface EmbedResponse extends BaseResponse {
FILE: src/types/inputList.ts
type ResponseItemList (line 8) | interface ResponseItemList {
type Message (line 45) | interface Message {
type ComputerCallOutput (line 74) | interface ComputerCallOutput {
type Output (line 112) | interface Output {
type AcknowledgedSafetyCheck (line 133) | interface AcknowledgedSafetyCheck {
type FunctionCallOutput (line 151) | interface FunctionCallOutput {
FILE: src/types/messagesResponse.ts
type CitationCharLocation (line 1) | interface CitationCharLocation {
type CitationPageLocation (line 15) | interface CitationPageLocation {
type CitationContentBlockLocation (line 29) | interface CitationContentBlockLocation {
type CitationsWebSearchResultLocation (line 43) | interface CitationsWebSearchResultLocation {
type TextCitation (line 55) | type TextCitation =
type TextBlock (line 61) | interface TextBlock {
type ToolUseCaller (line 81) | interface ToolUseCaller {
type ToolUseBlock (line 93) | interface ToolUseBlock {
type ServerToolUseBlock (line 109) | interface ServerToolUseBlock {
type WebSearchToolResultError (line 119) | interface WebSearchToolResultError {
type WebSearchResultBlock (line 130) | interface WebSearchResultBlock {
type WebSearchToolResultBlockContent (line 142) | type WebSearchToolResultBlockContent =
type WebSearchToolResultBlock (line 146) | interface WebSearchToolResultBlock {
type CodeExecutionToolResultErrorCode (line 157) | type CodeExecutionToolResultErrorCode =
type CodeExecutionToolResultError (line 166) | interface CodeExecutionToolResultError {
type CodeExecutionOutputBlock (line 175) | interface CodeExecutionOutputBlock {
type CodeExecutionResultBlock (line 184) | interface CodeExecutionResultBlock {
type CodeExecutionToolResultBlockContent (line 196) | type CodeExecutionToolResultBlockContent =
type CodeExecutionToolResultBlock (line 204) | interface CodeExecutionToolResultBlock {
type ThinkingBlock (line 212) | interface ThinkingBlock {
type RedactedThinkingBlock (line 220) | interface RedactedThinkingBlock {
type ContentBlock (line 226) | type ContentBlock =
type ANTHROPIC_STOP_REASON (line 235) | enum ANTHROPIC_STOP_REASON {
type ServerToolUsage (line 244) | interface ServerToolUsage {
type Usage (line 251) | interface Usage {
type MessagesResponse (line 283) | interface MessagesResponse {
FILE: src/types/modelResponses.ts
type ParsedResponseOutputText (line 5) | interface ParsedResponseOutputText<ParsedT> extends ResponseOutputText {
type ParsedContent (line 9) | type ParsedContent<ParsedT> =
type ParsedResponseOutputMessage (line 13) | interface ParsedResponseOutputMessage<ParsedT>
type ParsedResponseFunctionToolCall (line 18) | interface ParsedResponseFunctionToolCall
type ParsedResponseOutputItem (line 23) | type ParsedResponseOutputItem<ParsedT> =
type ParsedResponse (line 31) | interface ParsedResponse<ParsedT> extends OpenAIResponse {
type ResponseParseParams (line 37) | type ResponseParseParams = ResponseCreateParamsNonStreaming;
type ComputerTool (line 43) | interface ComputerTool {
type EasyInputMessage (line 72) | interface EasyInputMessage {
type FileSearchTool (line 96) | interface FileSearchTool {
type FileSearchToolRankingOptions (line 124) | interface FileSearchToolRankingOptions {
type FunctionTool (line 143) | interface FunctionTool {
type OpenAIResponse (line 171) | interface OpenAIResponse {
type IncompleteDetails (line 348) | interface IncompleteDetails {
type ResponseAudioDeltaEvent (line 358) | interface ResponseAudioDeltaEvent {
type ResponseAudioDoneEvent (line 373) | interface ResponseAudioDoneEvent {
type ResponseAudioTranscriptDeltaEvent (line 383) | interface ResponseAudioTranscriptDeltaEvent {
type ResponseAudioTranscriptDoneEvent (line 398) | interface ResponseAudioTranscriptDoneEvent {
type ResponseCodeInterpreterCallCodeDeltaEvent (line 408) | interface ResponseCodeInterpreterCallCodeDeltaEvent {
type ResponseCodeInterpreterCallCodeDoneEvent (line 428) | interface ResponseCodeInterpreterCallCodeDoneEvent {
type ResponseCodeInterpreterCallCompletedEvent (line 448) | interface ResponseCodeInterpreterCallCompletedEvent {
type ResponseCodeInterpreterCallInProgressEvent (line 468) | interface ResponseCodeInterpreterCallInProgressEvent {
type ResponseCodeInterpreterCallInterpretingEvent (line 488) | interface ResponseCodeInterpreterCallInterpretingEvent {
type ResponseCodeInterpreterToolCall (line 508) | interface ResponseCodeInterpreterToolCall {
type Logs (line 541) | interface Logs {
type Files (line 556) | interface Files {
type File (line 566) | interface File {
type ResponseCompletedEvent (line 583) | interface ResponseCompletedEvent {
type ResponseComputerToolCall (line 600) | interface ResponseComputerToolCall {
type Click (line 647) | interface Click {
type DoubleClick (line 674) | interface DoubleClick {
type Drag (line 695) | interface Drag {
type Path (line 720) | interface Path {
type Keypress (line 736) | interface Keypress {
type Move (line 753) | interface Move {
type Screenshot (line 774) | interface Screenshot {
type Scroll (line 785) | interface Scroll {
type Type (line 816) | interface Type {
type Wait (line 832) | interface Wait {
type PendingSafetyCheck (line 843) | interface PendingSafetyCheck {
type ResponseContent (line 864) | type ResponseContent =
type ResponseContentPartAddedEvent (line 874) | interface ResponseContentPartAddedEvent {
type ResponseContentPartDoneEvent (line 904) | interface ResponseContentPartDoneEvent {
type ResponseCreatedEvent (line 934) | interface ResponseCreatedEvent {
type ResponseError (line 949) | interface ResponseError {
type ResponseErrorEvent (line 964) | interface ResponseErrorEvent {
type ResponseFailedEvent (line 989) | interface ResponseFailedEvent {
type ResponseFileSearchCallCompletedEvent (line 1004) | interface ResponseFileSearchCallCompletedEvent {
type ResponseFileSearchCallInProgressEvent (line 1024) | interface ResponseFileSearchCallInProgressEvent {
type ResponseFileSearchCallSearchingEvent (line 1044) | interface ResponseFileSearchCallSearchingEvent {
type ResponseFileSearchToolCall (line 1066) | interface ResponseFileSearchToolCall {
type Result (line 1095) | interface Result {
type ResponseFormatTextConfig (line 1142) | type ResponseFormatTextConfig =
type ResponseFormatTextJSONSchemaConfig (line 1152) | interface ResponseFormatTextJSONSchemaConfig {
type ResponseFunctionCallArgumentsDeltaEvent (line 1189) | interface ResponseFunctionCallArgumentsDeltaEvent {
type ResponseFunctionCallArgumentsDoneEvent (line 1214) | interface ResponseFunctionCallArgumentsDoneEvent {
type ResponseFunctionToolCall (line 1238) | interface ResponseFunctionToolCall {
type ResponseFunctionWebSearch (line 1276) | interface ResponseFunctionWebSearch {
type ResponseInProgressEvent (line 1296) | interface ResponseInProgressEvent {
type ResponseIncludable (line 1318) | type ResponseIncludable =
type ResponseIncompleteEvent (line 1326) | interface ResponseIncompleteEvent {
type ResponseInput (line 1342) | type ResponseInput = Array<ResponseInputItem>;
type ResponseInputAudio (line 1347) | interface ResponseInputAudio {
type ResponseInputContent (line 1367) | type ResponseInputContent =
type ResponseInputFile (line 1375) | interface ResponseInputFile {
type ResponseInputImage (line 1401) | interface ResponseInputImage {
type ResponseInputItem (line 1432) | type ResponseInputItem =
type Message (line 1451) | interface Message {
type ComputerCallOutput (line 1478) | interface ComputerCallOutput {
type Output (line 1516) | interface Output {
type AcknowledgedSafetyCheck (line 1537) | interface AcknowledgedSafetyCheck {
type FunctionCallOutput (line 1558) | interface FunctionCallOutput {
type Reasoning (line 1591) | interface Reasoning {
type Content (line 1615) | interface Content {
type ItemReference (line 1631) | interface ItemReference {
type ResponseInputMessageContentList (line 1648) | type ResponseInputMessageContentList = Array<ResponseInputContent>;
type ResponseInputText (line 1653) | interface ResponseInputText {
type ResponseOutputAudio (line 1668) | interface ResponseOutputAudio {
type ResponseOutputItem (line 1688) | type ResponseOutputItem =
type ResponseOutputItemReasoning (line 1696) | interface ResponseOutputItemReasoning {
type ResponseOutputItemAddedEvent (line 1737) | interface ResponseOutputItemAddedEvent {
type ResponseOutputItemDoneEvent (line 1757) | interface ResponseOutputItemDoneEvent {
type ResponseOutputMessage (line 1777) | interface ResponseOutputMessage {
type ResponseOutputRefusal (line 1808) | interface ResponseOutputRefusal {
type ResponseOutputText (line 1823) | interface ResponseOutputText {
type FileCitation (line 1848) | interface FileCitation {
type URLCitation (line 1868) | interface URLCitation {
type FilePath (line 1898) | interface FilePath {
type ResponseRefusalDeltaEvent (line 1919) | interface ResponseRefusalDeltaEvent {
type ResponseRefusalDoneEvent (line 1949) | interface ResponseRefusalDoneEvent {
type ResponseStatus (line 1980) | type ResponseStatus =
type ResponseStreamEvent (line 1989) | type ResponseStreamEvent =
type ResponseTextAnnotationDeltaEvent (line 2026) | interface ResponseTextAnnotationDeltaEvent {
type FileCitation (line 2065) | interface FileCitation {
type URLCitation (line 2085) | interface URLCitation {
type FilePath (line 2115) | interface FilePath {
type ResponseTextConfig (line 2140) | interface ResponseTextConfig {
type ResponseTextDeltaEvent (line 2162) | interface ResponseTextDeltaEvent {
type ResponseTextDoneEvent (line 2192) | interface ResponseTextDoneEvent {
type ResponseUsage (line 2223) | interface ResponseUsage {
type OutputTokensDetails (line 2249) | interface OutputTokensDetails {
type ResponseWebSearchCallCompletedEvent (line 2260) | interface ResponseWebSearchCallCompletedEvent {
type ResponseWebSearchCallInProgressEvent (line 2280) | interface ResponseWebSearchCallInProgressEvent {
type ResponseWebSearchCallSearchingEvent (line 2300) | interface ResponseWebSearchCallSearchingEvent {
type Tool (line 2322) | type Tool = FileSearchTool | FunctionTool | ComputerTool | WebSearchTool;
type ToolChoiceFunction (line 2327) | interface ToolChoiceFunction {
type ToolChoiceOptions (line 2349) | type ToolChoiceOptions = 'none' | 'auto' | 'required';
type ToolChoiceTypes (line 2355) | interface ToolChoiceTypes {
type WebSearchTool (line 2378) | interface WebSearchTool {
type WebSearchToolUserLocation (line 2396) | interface WebSearchToolUserLocation {
type ResponseCreateParams (line 2425) | type ResponseCreateParams =
type ResponseCreateParamsBase (line 2429) | interface ResponseCreateParamsBase {
type ResponseCreateParamsNonStreaming (line 2596) | interface ResponseCreateParamsNonStreaming
type ResponseCreateParamsStreaming (line 2609) | interface ResponseCreateParamsStreaming
type ResponseRetrieveParams (line 2622) | interface ResponseRetrieveParams {
type ModelResponseDeleteResponse (line 2630) | interface ModelResponseDeleteResponse {
FILE: src/types/requestBody.ts
type RetrySettings (line 8) | interface RetrySettings {
type CacheSettings (line 17) | interface CacheSettings {
type StrategyModes (line 22) | enum StrategyModes {
type Strategy (line 29) | interface Strategy {
type Options (line 45) | interface Options {
type Targets (line 186) | interface Targets {
type Config (line 231) | interface Config {
type ContentType (line 248) | interface ContentType extends PromptCache {
type ToolCall (line 272) | interface ToolCall {
type MESSAGE_ROLES (line 283) | enum MESSAGE_ROLES {
constant SYSTEM_MESSAGE_ROLES (line 292) | const SYSTEM_MESSAGE_ROLES = ['system', 'developer'];
type OpenAIMessageRole (line 294) | type OpenAIMessageRole =
type ContentBlockChunk (line 302) | interface ContentBlockChunk extends Omit<ContentType, 'type'> {
type Message (line 311) | interface Message {
type PromptCache (line 329) | interface PromptCache {
type CitationMetadata (line 333) | interface CitationMetadata {
type CitationSource (line 337) | interface CitationSource {
type JsonSchema (line 348) | interface JsonSchema {
type Function (line 357) | interface Function {
type ToolChoiceObject (line 386) | interface ToolChoiceObject {
type CustomToolChoice (line 393) | interface CustomToolChoice {
type ToolChoice (line 400) | type ToolChoice =
type Tool (line 414) | interface Tool extends PromptCache {
type Params (line 427) | interface Params {
type Examples (line 490) | interface Examples {
type FullRequestBody (line 499) | interface FullRequestBody {
type ShortConfig (line 510) | interface ShortConfig {
type ShortRequestBody (line 539) | interface ShortRequestBody {
type RequestBody (line 550) | type RequestBody = FullRequestBody | ShortRequestBody;
FILE: src/types/responseBody.ts
type CitationSource (line 1) | interface CitationSource {
type CitationMetadata (line 8) | interface CitationMetadata {
type PalmMessage (line 12) | interface PalmMessage {
type ContentFilter (line 18) | interface ContentFilter {
type PalmChatCompleteResponse (line 23) | interface PalmChatCompleteResponse {
type PalmTextOutput (line 30) | interface PalmTextOutput {
type safetyRatings (line 35) | interface safetyRatings {
type PalmFilter (line 46) | interface PalmFilter {
type PalmError (line 50) | interface PalmError {
type PalmCompleteResponse (line 56) | interface PalmCompleteResponse {
FILE: src/types/shared.ts
type ComparisonFilter (line 5) | interface ComparisonFilter {
type CompoundFilter (line 33) | interface CompoundFilter {
type Metadata (line 54) | type Metadata = Record<string, string>;
type Reasoning (line 62) | interface Reasoning {
type ReasoningEffort (line 91) | type ReasoningEffort = 'low' | 'medium' | 'high' | null;
type ResponseFormatText (line 96) | interface ResponseFormatText {
type ResponseFormatJSONObject (line 108) | interface ResponseFormatJSONObject {
type CursorPageParams (line 115) | interface CursorPageParams {
FILE: src/utils.ts
type SplitPatternType (line 58) | type SplitPatternType = '\n\n' | '\r\n\r\n' | '\n' | '\r\n' | ' ';
function convertKeysToCamelCase (line 81) | function convertKeysToCamelCase(
FILE: src/utils/CryptoUtils.ts
class CryptoUtils (line 2) | class CryptoUtils {
method normalizePemKey (line 6) | private static normalizePemKey(pemKey: string): string {
method importPrivateKey (line 61) | private static async importPrivateKey(
method base64ToArrayBuffer (line 97) | private static base64ToArrayBuffer(base64: string): ArrayBuffer {
method arrayBufferToBase64 (line 110) | private static arrayBufferToBase64(buffer: ArrayBuffer): string {
method sign (line 121) | static async sign(privateKey: CryptoKey, data: string): Promise<string> {
method sha256 (line 134) | static async sha256(data: string): Promise<string> {
method loadPrivateKey (line 141) | static async loadPrivateKey(
FILE: src/utils/env.ts
function getValueOrFileContents (line 12) | function getValueOrFileContents(value?: string, ignore?: boolean) {
FILE: src/utils/misc.ts
function toSnakeCase (line 4) | function toSnakeCase(str: string) {
FILE: tests/integration/src/handlers/requestBuilder.ts
class RequestBuilder (line 7) | class RequestBuilder {
method constructor (line 13) | constructor() {
method useGet (line 35) | useGet() {
method client (line 40) | get client() {
method options (line 44) | get options() {
method model (line 65) | model(model: string) {
method messages (line 73) | messages(messages: any[]) {
method maxTokens (line 81) | maxTokens(maxTokens: number) {
method stream (line 89) | stream(stream: boolean) {
method provider (line 97) | provider(provider: string) {
method providerHeaders (line 107) | providerHeaders(providerHeaders: Record<string, string>) {
method addHeaders (line 121) | addHeaders(headers: Record<string, string>) {
method apiKey (line 129) | apiKey(apiKey: string) {
method body (line 138) | body(body: Record<string, any> | FormData) {
method config (line 147) | config(config: any) {
class URLBuilder (line 161) | class URLBuilder {
method constructor (line 164) | constructor() {}
method url (line 166) | get url() {
method endpoint (line 170) | endpoint(endpoint: string) {
method chat (line 175) | chat() {
method files (line 180) | files() {
method transcription (line 185) | transcription() {
method images (line 190) | images() {
method path (line 195) | path(path: string) {
method clear (line 200) | clear() {
FILE: tests/unit/src/handlers/services/benchmark.ts
function createSampleData (line 9) | function createSampleData(size: number) {
function measureOperation (line 58) | function measureOperation(name: string, fn: () => void, indent: number =...
function measureWithIterations (line 67) | function measureWithIterations(
function runBenchmarks (line 95) | async function runBenchmarks() {
Copy disabled (too large)
Download .json
Condensed preview — 724 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (26,787K chars).
[
{
"path": ".dockerignore",
"chars": 10,
"preview": ".toml\ndocs"
},
{
"path": ".git-blame-ignore-revs",
"chars": 70,
"preview": "# Initial prettier formatting\n77f32e57b14bd3585169b7bc884ff9ddf38e8ea1"
},
{
"path": ".gitattributes",
"chars": 709,
"preview": "# Declare files that will always have LF line endings on checkout.\n*.sh text eol=lf\n\n# Denote all files that are truly b"
},
{
"path": ".github/CODE_OF_CONDUCT.md",
"chars": 5366,
"preview": "<p align=\"right\">\n <strong>English</strong>|<a href=\"https://github.com/Portkey-AI/gateway/blob/main/.github/cn.CODE_OF"
},
{
"path": ".github/CONTRIBUTING.cn.md",
"chars": 1196,
"preview": "## 🎉 欢迎\n你好,感谢你考虑为Portkey的AI网关做出贡献!无论你是在报告一个bug,建议一个功能,改进文档,还是编写代码,你的贡献对我们来说都是非常宝贵的。\n\n## 🚀 快速开始\n1. 在Github上Fork仓库。\n2. 将你f"
},
{
"path": ".github/CONTRIBUTING.md",
"chars": 2341,
"preview": "## 🎉 Welcome\nHello and thank you for considering contributing to Portkey's AI Gateway! Whether you're reporting a bug, s"
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.yml",
"chars": 694,
"preview": "name: Bug Report\ndescription: Report any issue with the project\nlabels: [\"bug\"]\nbody:\n - type: textarea\n id: what-ha"
},
{
"path": ".github/ISSUE_TEMPLATE/config.yml",
"chars": 345,
"preview": "blank_issues_enabled: true\ncontact_links:\n - name: Discord for Support & Discussions\n url: https://discord.com/invit"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.yml",
"chars": 719,
"preview": "name: Feature Request \ndescription: Suggest a new provider to integrate, new features, or something more\ntitle: \"[Featur"
},
{
"path": ".github/README.cn.md",
"chars": 9262,
"preview": "<div align=\"center\">\n<img src=\"/docs/images/gateway-border.png\" width=350>\n\n<p align=\"right\">\n<a href=\"../README.md\">Eng"
},
{
"path": ".github/README.jp.md",
"chars": 18830,
"preview": "<div align=\"center\">\n\n<p align=\"right\">\n <a href=\"../README.md\">English</a> | <a href=\"./README.cn.md\">中文</a> | <stron"
},
{
"path": ".github/SECURITY.md",
"chars": 237,
"preview": "# Security Policy\n\n## Supported Versions\n\n| Version | Supported |\n| ------- | ------------------ |\n| 1.x.x | "
},
{
"path": ".github/SUPPORT.md",
"chars": 416,
"preview": "## How to file issues and get help \n\nThis project uses GitHub Issues to track bugs and feature requests. Please search "
},
{
"path": ".github/cn.CODE_OF_CONDUCT.md",
"chars": 1828,
"preview": "<p align=\"right\">\n<a href=\".github\\CODE_OF_CONDUCT.md\">English</a>|<strong>中文</strong> \n</p>\n\n# 贡献者公约行为准则\n\n## 我们的承诺\n\n我们作"
},
{
"path": ".github/pull_request_template.md",
"chars": 501,
"preview": "**Description:** (required)\n- Detailed change 1\n- Detailed change 2\n\n**Tests Run/Test cases added:** (required)\n- [ ] De"
},
{
"path": ".github/workflows/check_code_formatting.yml",
"chars": 445,
"preview": "name: Check Prettier Formatting\n\non:\n pull_request:\n branches:\n - main\n\njobs:\n check-formatting:\n runs-on: "
},
{
"path": ".github/workflows/docker_publish.yml",
"chars": 1238,
"preview": "name: Publish Docker image\n\non:\n release:\n types: [published]\n\njobs:\n push_to_registry:\n name: Push Docker image"
},
{
"path": ".github/workflows/link-checker.yml",
"chars": 1645,
"preview": "name: Check Markdown links\n\non:\n push:\n paths:\n - '**/*.md' # Only run when markdown files change\n pull_reques"
},
{
"path": ".github/workflows/npm_publish.yml",
"chars": 509,
"preview": "name: Publish to NPM\non:\n release:\n types: [published]\njobs:\n build:\n runs-on: ubuntu-latest\n steps:\n - "
},
{
"path": ".github/workflows/run_tests.yml",
"chars": 2278,
"preview": "name: Gateway Tests\n\non:\n issue_comment:\n types: [created]\n\njobs:\n gateway-tests:\n if: ${{ github.event.issue.pu"
},
{
"path": ".github/workflows/triage-label.yml",
"chars": 576,
"preview": "name: Auto Triage Label\n\non:\n issues:\n types: [opened]\n\njobs:\n label_issues:\n runs-on: ubuntu-latest\n\n permis"
},
{
"path": ".gitignore",
"chars": 2304,
"preview": "# Local configuration file\nconf.json\n\n# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n"
},
{
"path": ".husky/pre-commit",
"chars": 53,
"preview": "npm run format:check || (npm run format && return 1)\n"
},
{
"path": ".husky/pre-push",
"chars": 16,
"preview": "npm run pre-push"
},
{
"path": ".prettierignore",
"chars": 67,
"preview": "node_modules\npackage-lock.json\nbuild\n.wrangler\npublic\nwrangler.toml"
},
{
"path": ".prettierrc",
"chars": 179,
"preview": "{\n \"semi\": true,\n \"tabWidth\": 2,\n \"printWidth\": 80,\n \"endOfLine\": \"lf\",\n \"singleQuote\": true,\n \"arrowParens\": \"alw"
},
{
"path": ".vscode/launch.json",
"chars": 1233,
"preview": "{\n /*\n 1. steps to run wrangler debugger (https://blog.cloudflare.com/debugging-cloudflare-workers/)\n - run `npm "
},
{
"path": ".vscode/tasks.json",
"chars": 760,
"preview": "{\n // See https://go.microsoft.com/fwlink/?LinkId=733558\n // for the documentation about the tasks.json format\n \"vers"
},
{
"path": "CLAUDE.md",
"chars": 3382,
"preview": "# CLAUDE.md\n\nThis file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.\n\n## "
},
{
"path": "Dockerfile",
"chars": 1172,
"preview": "# Use the official Node.js runtime as a parent image\nFROM node:20-alpine AS build\n\n# Set the working directory in the co"
},
{
"path": "LICENSE",
"chars": 1069,
"preview": "MIT License\n\nCopyright (c) 2024 Portkey, Inc\n\nPermission is hereby granted, free of charge, to any person obtaining a co"
},
{
"path": "README.md",
"chars": 21353,
"preview": "\n<p align=\"right\">\n <strong>English</strong> | <a href=\"./.github/README.cn.md\">中文</a> | <a href=\"./.github/README.jp."
},
{
"path": "conf.example.json",
"chars": 830,
"preview": "{\n \"plugins_enabled\": [\n \"default\",\n \"portkey\",\n \"aporia\",\n \"sydelabs\",\n \"pillar\",\n \"patronus\",\n \""
},
{
"path": "cookbook/README.md",
"chars": 2981,
"preview": "# Portkey Practitioners' Cookbooks\n\n<img src=\"../docs/images/cookbook-header.png\" height=300 alt=\"header\" />\n\n#### Strat"
},
{
"path": "cookbook/getting-started/automatic-retries-on-failures.md",
"chars": 4640,
"preview": "# Automatically retry requests to LLMs\n\nA sudden timeout or error could harm the user experience and hurt your service's"
},
{
"path": "cookbook/getting-started/enable-cache.md",
"chars": 7265,
"preview": "# Prevent unnecessary LLM requests with the Portkey Cache\n\nIf you have multiple users of your GenAI app triggering the s"
},
{
"path": "cookbook/getting-started/fallback-from-openai-to-azure.ipynb",
"chars": 13333,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {\n \"colab_type\": \"text\",\n \"id\": \"vie"
},
{
"path": "cookbook/getting-started/fallback-from-stable-diffusion-to-dall-e.ipynb",
"chars": 11240,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {\n \"id\": \"view-in-github\",\n \"colab_t"
},
{
"path": "cookbook/getting-started/gentle-introduction-to-portkey-gateway.ipynb",
"chars": 11437,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/getting-started/image-generation.ipynb",
"chars": 8728104,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {\n \"colab_type\": \"text\",\n \"id\": \"vie"
},
{
"path": "cookbook/getting-started/resilient-loadbalancing-with-failure-mitigating-fallbacks.md",
"chars": 9202,
"preview": "# Setting up resilient Load balancers with failure-mitigating Fallbacks\n\nCompanies often face challenges of scaling thei"
},
{
"path": "cookbook/getting-started/writing-your-first-gateway-config.md",
"chars": 10210,
"preview": "# 101 on Portkey's Gateway Configs\n\nYou are likely familiar with how to make an API call to GPT4 for chat completions. H"
},
{
"path": "cookbook/guardrails/Langchain Chatbot with PII Guardrails.ipynb",
"chars": 18286,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"source\": [\n \"["
},
{
"path": "cookbook/integrations/Phidata_with_ Perplexity.ipynb",
"chars": 51600,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/integrations/Phidata_with_Portkey.ipynb",
"chars": 94099,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/integrations/ReAct Agents Portkey.ipynb",
"chars": 549709,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/integrations/Sutra_with_Portkey.ipynb",
"chars": 13608,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {\n \"id\": \"title-section\"\n },\n \"so"
},
{
"path": "cookbook/integrations/Tool_Use_with_Portkey.ipynb",
"chars": 63704,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/integrations/anyscale.md",
"chars": 12316,
"preview": "# Portkey + Anyscale\n\nPortkey helps bring Anyscale APIs to production with its abstractions for observability, fallbacks"
},
{
"path": "cookbook/integrations/deepinfra.ipynb",
"chars": 477285,
"preview": "{\"nbformat\":4,\"nbformat_minor\":0,\"metadata\":{\"colab\":{\"provenance\":[]},\"kernelspec\":{\"name\":\"python3\",\"display_name\":\"Py"
},
{
"path": "cookbook/integrations/groq.ipynb",
"chars": 157684,
"preview": "{\"cells\":[{\"cell_type\":\"markdown\",\"source\":[\"<h1 align=\\\"center\\\">\\n\",\" <a href=\\\"https://portkey.ai\\\">\\n\",\" <img wi"
},
{
"path": "cookbook/integrations/langchain.ipynb",
"chars": 5840,
"preview": "{\"nbformat\":4,\"nbformat_minor\":0,\"metadata\":{\"colab\":{\"provenance\":[]},\"kernelspec\":{\"name\":\"python3\",\"display_name\":\"Py"
},
{
"path": "cookbook/integrations/mistral.md",
"chars": 5646,
"preview": "# Portkey + Mistral\nPortkey helps bring Mistral's APIs to production with its observability suite & AI Gateway. Use the "
},
{
"path": "cookbook/integrations/mixtral-8x22b.ipynb",
"chars": 480782,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/integrations/ncompass.ipynb",
"chars": 478612,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {\n \"id\": \"bFj2ZAU6BtiR\"\n },\n \"source\": [\n \"<h1 al"
},
{
"path": "cookbook/integrations/openai.ipynb",
"chars": 153956,
"preview": "{\"cells\":[{\"cell_type\":\"markdown\",\"source\":[\"["
},
{
"path": "cookbook/integrations/segmind.ipynb",
"chars": 62044,
"preview": "{\"cells\":[{\"cell_type\":\"markdown\",\"metadata\":{\"id\":\"eC-K7K6ZBw70\"},\"source\":[\"<h1 align=\\\"center\\\">\\n\",\" <a href=\\\"http"
},
{
"path": "cookbook/integrations/vercel/app/api/chat/route.ts",
"chars": 336,
"preview": "import { streamText } from 'ai';\nimport { openai } from '@ai-sdk/openai';\n\nexport async function POST(request: Request) "
},
{
"path": "cookbook/integrations/vercel/app/examples/basic-chatbot/page.tsx",
"chars": 530,
"preview": "'use client';\n\nimport { useChat } from 'ai/react';\n\nexport default function Chat() {\n const { messages, input, handleIn"
},
{
"path": "cookbook/integrations/vercel/app/examples/generate-text/action.ts",
"chars": 733,
"preview": "'use server';\n\nimport { generateText } from 'ai';\nimport { createPortkey } from '@portkey-ai/vercel-provider';\n\nexport c"
},
{
"path": "cookbook/integrations/vercel/app/examples/generate-text/conditional-routing.ts",
"chars": 1515,
"preview": "'use server';\n\nimport { generateText } from 'ai';\nimport { createPortkey } from '@portkey-ai/vercel-provider';\n\nexport c"
},
{
"path": "cookbook/integrations/vercel/app/examples/generate-text/fallback.ts",
"chars": 1183,
"preview": "'use server';\n\nimport { generateText } from 'ai';\nimport { createPortkey } from '@portkey-ai/vercel-provider';\n\nexport c"
},
{
"path": "cookbook/integrations/vercel/app/examples/generate-text/guardrails.ts",
"chars": 1057,
"preview": "'use server';\n\nimport { generateText } from 'ai';\nimport { createPortkey } from '@portkey-ai/vercel-provider';\n\nexport c"
},
{
"path": "cookbook/integrations/vercel/app/examples/generate-text/load-balance.ts",
"chars": 1230,
"preview": "'use server';\n\nimport { generateText } from 'ai';\nimport { createPortkey } from '@portkey-ai/vercel-provider';\n\nexport c"
},
{
"path": "cookbook/integrations/vercel/app/examples/generate-text/page.tsx",
"chars": 607,
"preview": "'use client';\n\nimport { Button } from '@/components/ui/button';\nimport { generateTextAction } from './action';\nimport { "
},
{
"path": "cookbook/integrations/vercel/app/examples/generate-ui-streamui/action.tsx",
"chars": 1880,
"preview": "'use server';\n\nimport { createAI, getMutableAIState, streamUI } from 'ai/rsc';\nimport { openai } from '@ai-sdk/openai';\n"
},
{
"path": "cookbook/integrations/vercel/app/examples/generate-ui-streamui/joke-component.tsx",
"chars": 614,
"preview": "'use client';\n\nimport { useState } from 'react';\nimport { Button } from '@/components/ui/button';\nimport { Joke } from '"
},
{
"path": "cookbook/integrations/vercel/app/examples/generate-ui-streamui/joke.ts",
"chars": 271,
"preview": "import { DeepPartial } from 'ai';\nimport { z } from 'zod';\n\nexport const jokeSchema = z.object({\n setup: z.string().des"
},
{
"path": "cookbook/integrations/vercel/app/examples/generate-ui-streamui/page.tsx",
"chars": 1306,
"preview": "'use client';\n\nimport { useState } from 'react';\nimport { ClientMessage } from './action';\nimport { useActions, useUISta"
},
{
"path": "cookbook/integrations/vercel/app/examples/layout.tsx",
"chars": 127,
"preview": "export default function Layout({ children }: { children: React.ReactNode }) {\n return <main className=\"\">{children}</ma"
},
{
"path": "cookbook/integrations/vercel/app/examples/stream-text/action.ts",
"chars": 581,
"preview": "'use server';\n\nimport { streamText } from 'ai';\nimport { openai } from '@ai-sdk/openai';\nimport { createStreamableValue "
},
{
"path": "cookbook/integrations/vercel/app/examples/stream-text/page.tsx",
"chars": 719,
"preview": "'use client';\n\nimport { Button } from '@/components/ui/button';\nimport { streamTextAction } from './action';\nimport { us"
},
{
"path": "cookbook/integrations/vercel/app/examples/tools/basic/action.ts",
"chars": 1357,
"preview": "'use server';\n\nimport { openai } from '@ai-sdk/openai';\nimport { createPortkey } from '@portkey-ai/vercel-provider';\nimp"
},
{
"path": "cookbook/integrations/vercel/app/examples/tools/basic/page.tsx",
"chars": 960,
"preview": "'use client';\n\nimport { Button } from '@/components/ui/button';\nimport { generateTextAction } from './action';\nimport { "
},
{
"path": "cookbook/integrations/vercel/app/globals.css",
"chars": 1507,
"preview": "@tailwind base;\n @tailwind components;\n @tailwind utilities;\n\n @layer base {\n :root {\n --background: 0 0% 100"
},
{
"path": "cookbook/integrations/vercel/app/layout.tsx",
"chars": 789,
"preview": "import type { Metadata } from 'next';\nimport { Inter } from 'next/font/google';\nimport './globals.css';\nimport { AI } fr"
},
{
"path": "cookbook/integrations/vercel/app/page.tsx",
"chars": 1002,
"preview": "import { Link } from '@/components/link';\n\nexport default function Page() {\n return (\n <main className=\"space-y-4\">\n"
},
{
"path": "cookbook/integrations/vercel/components/back-button.tsx",
"chars": 237,
"preview": "'use client';\nimport { Link } from './link';\nimport { usePathname } from 'next/navigation';\n\nexport const BackButton = ("
},
{
"path": "cookbook/integrations/vercel/components/link.tsx",
"chars": 242,
"preview": "import NextLink from 'next/link';\nexport const Link = ({\n href,\n children,\n}: {\n href: string;\n children: React.Reac"
},
{
"path": "cookbook/integrations/vercel/components/ui/button.tsx",
"chars": 1846,
"preview": "import * as React from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { cva, type VariantProps } from 'cla"
},
{
"path": "cookbook/integrations/vercel/components/ui/card.tsx",
"chars": 1905,
"preview": "import * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\nconst Card = React.forwardRef<\n HTMLDivElement,\n R"
},
{
"path": "cookbook/integrations/vercel/components/ui/input.tsx",
"chars": 830,
"preview": "import * as React from 'react';\n\nimport { cn } from '@/lib/utils';\n\nexport interface InputProps\n extends React.InputHTM"
},
{
"path": "cookbook/integrations/vercel/components/ui/label.tsx",
"chars": 733,
"preview": "'use client';\n\nimport * as React from 'react';\nimport * as LabelPrimitive from '@radix-ui/react-label';\nimport { cva, ty"
},
{
"path": "cookbook/integrations/vercel/components.json",
"chars": 344,
"preview": "{\n \"$schema\": \"https://ui.shadcn.com/schema.json\",\n \"style\": \"default\",\n \"rsc\": true,\n \"tsx\": true,\n \"tailwind\": {\n"
},
{
"path": "cookbook/integrations/vercel/core/generate-text.ts",
"chars": 313,
"preview": "import { openai } from '@ai-sdk/openai';\nimport { generateText } from 'ai';\nimport dotenv from 'dotenv';\n\ndotenv.config("
},
{
"path": "cookbook/integrations/vercel/core/stream-text.ts",
"chars": 373,
"preview": "import { openai } from '@ai-sdk/openai';\nimport { streamText } from 'ai';\nimport dotenv from 'dotenv';\n\ndotenv.config();"
},
{
"path": "cookbook/integrations/vercel/core/tools.ts",
"chars": 1163,
"preview": "import { openai } from '@ai-sdk/openai';\nimport { generateText, streamText } from 'ai';\nimport dotenv from 'dotenv';\nimp"
},
{
"path": "cookbook/integrations/vercel/lib/utils.ts",
"chars": 169,
"preview": "import { type ClassValue, clsx } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: C"
},
{
"path": "cookbook/integrations/vercel/next-env.d.ts",
"chars": 228,
"preview": "/// <reference types=\"next\" />\n/// <reference types=\"next/image-types/global\" />\n\n// NOTE: This file should not be edite"
},
{
"path": "cookbook/integrations/vercel/next.config.mjs",
"chars": 92,
"preview": "/** @type {import('next').NextConfig} */\nconst nextConfig = {};\n\nexport default nextConfig;\n"
},
{
"path": "cookbook/integrations/vercel/package.json",
"chars": 1056,
"preview": "{\n \"name\": \"one\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"scripts\": {\n \"dev\": \"next dev --turbo\",\n \"build\": \""
},
{
"path": "cookbook/integrations/vercel/postcss.config.js",
"chars": 83,
"preview": "module.exports = {\n plugins: {\n tailwindcss: {},\n autoprefixer: {},\n },\n};\n"
},
{
"path": "cookbook/integrations/vercel/readme.md",
"chars": 7673,
"preview": "# Portkey + Vercel AI SDK\n\nPortkey natively integrates with the Vercel AI SDK to make your apps production-ready and rel"
},
{
"path": "cookbook/integrations/vercel/tailwind.config.ts",
"chars": 2184,
"preview": "import type { Config } from 'tailwindcss';\n\nconst config = {\n darkMode: ['class'],\n content: [\n './pages/**/*.{ts,t"
},
{
"path": "cookbook/integrations/vercel/tsconfig.json",
"chars": 574,
"preview": "{\n \"compilerOptions\": {\n \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"],\n \"allowJs\": true,\n \"skipLibCheck\": true,\n "
},
{
"path": "cookbook/integrations/vercel-ai.md",
"chars": 11079,
"preview": "## Portkey is the control panel for your Vercel AI app. It makes your LLM integrations prod-ready, reliable, fast, and c"
},
{
"path": "cookbook/monitoring-agents/Autogen_with_Telemetry.ipynb",
"chars": 27652,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/monitoring-agents/ControlFlow_with_Telemetry.ipynb",
"chars": 1663357,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/monitoring-agents/CrewAI_with_Telemetry.ipynb",
"chars": 1653182,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/monitoring-agents/Llama_Agents_with_Telemetry.ipynb",
"chars": 1925073,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/providers/aibadgr.ipynb",
"chars": 5459,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {},\n \"source\": [\n \"# Portkey + AI Badg"
},
{
"path": "cookbook/providers/anthropic.ipynb",
"chars": 156850,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"source\": [\n \"<h1 align=\\\"center\\\">\\n\",\n \" <a h"
},
{
"path": "cookbook/providers/deepinfra.ipynb",
"chars": 477285,
"preview": "{\"nbformat\":4,\"nbformat_minor\":0,\"metadata\":{\"colab\":{\"provenance\":[]},\"kernelspec\":{\"name\":\"python3\",\"display_name\":\"Py"
},
{
"path": "cookbook/providers/groq.ipynb",
"chars": 157684,
"preview": "{\"cells\":[{\"cell_type\":\"markdown\",\"source\":[\"<h1 align=\\\"center\\\">\\n\",\" <a href=\\\"https://portkey.ai\\\">\\n\",\" <img wi"
},
{
"path": "cookbook/providers/mistral.ipynb",
"chars": 477818,
"preview": "{\"cells\":[{\"cell_type\":\"markdown\",\"source\":[\"["
},
{
"path": "cookbook/providers/ncompass.ipynb",
"chars": 478612,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {\n \"id\": \"bFj2ZAU6BtiR\"\n },\n \"source\": [\n \"<h1 al"
},
{
"path": "cookbook/providers/nvidia.ipynb",
"chars": 477395,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {\n \"id\": \"bFj2ZAU6BtiR\"\n },\n \"sou"
},
{
"path": "cookbook/providers/openai.ipynb",
"chars": 153956,
"preview": "{\"cells\":[{\"cell_type\":\"markdown\",\"source\":[\"["
},
{
"path": "cookbook/providers/segmind.ipynb",
"chars": 1900330,
"preview": "{\"nbformat\":4,\"nbformat_minor\":0,\"metadata\":{\"colab\":{\"provenance\":[]},\"kernelspec\":{\"name\":\"python3\",\"display_name\":\"Py"
},
{
"path": "cookbook/providers/together.ipynb",
"chars": 479434,
"preview": "{\"nbformat\":4,\"nbformat_minor\":0,\"metadata\":{\"colab\":{\"provenance\":[]},\"kernelspec\":{\"name\":\"python3\",\"display_name\":\"Py"
},
{
"path": "cookbook/use-cases/Claude_3_5_Sonnet_vs_GPT_4o_Portkey.ipynb",
"chars": 135128,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/use-cases/Claude_3_5_Sonnet_with_Portkey.ipynb",
"chars": 155955,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"source\": [\n \"<h1 align=\\\"center\\\">\\n\",\n \" <a h"
},
{
"path": "cookbook/use-cases/Contextual Embeddings Guide Anthropic, Cohere, Voyage.ipynb",
"chars": 61503,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"source\": [\n \"["
},
{
"path": "cookbook/use-cases/GPT-4o & Portkey/Video Processing - GPT-4o & Portkey.ipynb",
"chars": 459045,
"preview": "{\"nbformat\":4,\"nbformat_minor\":0,\"metadata\":{\"colab\":{\"provenance\":[]},\"kernelspec\":{\"name\":\"python3\",\"display_name\":\"Py"
},
{
"path": "cookbook/use-cases/LMSYS Series/Comparision_of_Top_6_LMSYS_Vison_models_using_Portkey.ipynb",
"chars": 330177,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"metadata\": {\n \"id\": \"pNpHQn6FlCL1\"\n },\n \"sou"
},
{
"path": "cookbook/use-cases/LMSYS Series/README.md",
"chars": 565,
"preview": "# LMSYS Series\n\nLMSYS is THE defining leaderboard to compare raw capabilities of various LLMs. It has so far collected o"
},
{
"path": "cookbook/use-cases/LMSYS Series/comparing-top10-LMSYS-models-with-Portkey.ipynb",
"chars": 10480,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/use-cases/Nemotron_GPT_Finetuning_Portkey.ipynb",
"chars": 54811,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/use-cases/Testing_Top_Vision_Models.ipynb",
"chars": 31107,
"preview": "{\n \"nbformat\": 4,\n \"nbformat_minor\": 0,\n \"metadata\": {\n \"colab\": {\n \"provenance\": []\n },\n \"kernelspec\":"
},
{
"path": "cookbook/use-cases/llama-3-on-groq.ipynb",
"chars": 155207,
"preview": "{\n \"cells\": [\n {\n \"cell_type\": \"markdown\",\n \"source\": [\n \"<h1 align=\\\"center\\\">\\n\",\n \" <a h"
},
{
"path": "cookbook/use-cases/run-gateway-on-prompts-from-langchain-hub.md",
"chars": 5788,
"preview": "# How to use Prompts from Langchain Hub and Requests through Portkey\n\nWriting the right prompt is often hard to get a qu"
},
{
"path": "cookbook/use-cases/smart-fallback-with-model-optimized-prompts.md",
"chars": 9186,
"preview": "# Smart Fallback with Model-Optimized Prompts\n\nPortkey can help you easily create fallbacks from one LLM to another, mak"
},
{
"path": "cookbook/use-cases/supabase-pgvector-and-portkey.md",
"chars": 10259,
"preview": "# Build an article suggestion app with Supabase pgvector, and Portkey\n\nConsider that you have list of support articles t"
},
{
"path": "cookbook/use-cases/use-openai-sdk-with-portkey-prompt-templates.md",
"chars": 8325,
"preview": "# How to use OpenAI SDK with Portkey Prompt Templates\n\nPortkey's Prompt Playground allows you to test and tinker with va"
},
{
"path": "deployment.yaml",
"chars": 1029,
"preview": "apiVersion: v1\nkind: Namespace\nmetadata:\n name: portkeyai\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: po"
},
{
"path": "docker-compose.yaml",
"chars": 118,
"preview": "version: '3'\nservices:\n web:\n ports:\n - \"8787:8787\"\n image: \"portkeyai/gateway:latest\"\n restart: always"
},
{
"path": "docs/deploy-on-replit.md",
"chars": 1892,
"preview": "<div align=\"center\">\n<img src=\"/docs/images/gateway-border.png\" width=350>\n\n# AI Gateway\n### Route to 100+ LLMs with 1 f"
},
{
"path": "docs/installation-deployments.md",
"chars": 15868,
"preview": "# How to Deploy the Gateway?\n\n1. [Managed Deployment by Portkey](#managed-deployment) for quick setup without infrastruc"
},
{
"path": "eslint.config.js",
"chars": 430,
"preview": "import tseslint from 'typescript-eslint';\n\nexport default tseslint.config({\n ignores: ['.wrangler/**', 'node_modules/**"
},
{
"path": "initializeSettings.ts",
"chars": 2104,
"preview": "export const defaultOrganisationDetails = {\n id: 'self-hosted-organisation',\n name: 'Portkey self hosted',\n settings:"
},
{
"path": "jest.config.js",
"chars": 215,
"preview": "/** @type {import('ts-jest').JestConfigWithTsJest} **/\nexport default {\n testEnvironment: 'node',\n transform: {\n '^"
},
{
"path": "package.json",
"chars": 2410,
"preview": "{\n \"name\": \"@portkey-ai/gateway\",\n \"version\": \"1.15.2\",\n \"description\": \"A fast AI gateway by Portkey\",\n \"repository"
},
{
"path": "patches/@types+async-retry+1.4.5.patch",
"chars": 709,
"preview": "diff --git a/node_modules/@types/async-retry/index.d.ts b/node_modules/@types/async-retry/index.d.ts\nindex ed730fe..20c0"
},
{
"path": "patches/async-retry+1.3.3.patch",
"chars": 417,
"preview": "diff --git a/node_modules/async-retry/lib/index.js b/node_modules/async-retry/lib/index.js\nindex d8f0c8a..d7a545e 100644"
},
{
"path": "plugins/Contributing.md",
"chars": 3732,
"preview": "## 🎉 Welcome\n\nHello and Thank you for your interest in contributing to Portkey Gateway Plugins! We're excited to welcome"
},
{
"path": "plugins/README.md",
"chars": 7757,
"preview": "# Portkey Gateway Plugins\n\n## Table of Contents\n- [Portkey Gateway Plugins](#portkey-gateway-plugins)\n - [Table of Cont"
},
{
"path": "plugins/acuvity/helper.test.ts",
"chars": 3311,
"preview": "import { ResponseHelper, GuardName, GuardResult } from './helper';\nimport { Extraction } from './model';\n\ndescribe('Resp"
},
{
"path": "plugins/acuvity/helper.ts",
"chars": 6657,
"preview": "import { Extraction, Textualdetection, TextualdetectionType } from './model';\n\nexport interface GuardResult {\n matched:"
},
{
"path": "plugins/acuvity/manifest.json",
"chars": 10265,
"preview": "{\n \"id\": \"acuvity\",\n \"description\": \"acuvity Plugin\",\n \"credentials\": {\n \"type\": \"object\",\n \"properties\": {\n "
},
{
"path": "plugins/acuvity/model.ts",
"chars": 3560,
"preview": "export type ClosedEnum<T> = T[keyof T];\n\nexport type Modality = {\n /**\n * The group of data.\n */\n group: string;\n "
},
{
"path": "plugins/acuvity/scan.test.ts",
"chars": 20440,
"preview": "import testCreds from './.creds.json';\nimport { handler as acuvityHandler } from './scan';\n\nimport { PluginContext, Plug"
},
{
"path": "plugins/acuvity/scan.ts",
"chars": 7609,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport {\n getApexUrl"
},
{
"path": "plugins/aporia/aporia.test.ts",
"chars": 852,
"preview": "import testCreds from './.creds.json';\nimport { handler as validateProjectHandler } from './validateProject';\n\nfunction "
},
{
"path": "plugins/aporia/manifest.json",
"chars": 1211,
"preview": "{\n \"id\": \"aporia\",\n \"description\": \"Aporia Guardrails mitigates LLM hallucinations, inappropriate responses, prompt in"
},
{
"path": "plugins/aporia/validateProject.ts",
"chars": 2926,
"preview": "import { Message } from '../../src/types/requestBody';\nimport {\n HookEventType,\n PluginContext,\n PluginHandler,\n Plu"
},
{
"path": "plugins/azure/azure.test.ts",
"chars": 10733,
"preview": "import { describe, it, expect, jest, beforeEach } from '@jest/globals';\nimport { handler as piiHandler } from './pii';\ni"
},
{
"path": "plugins/azure/contentSafety.ts",
"chars": 3817,
"preview": "import { Agent } from 'https';\nimport {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '."
},
{
"path": "plugins/azure/manifest.json",
"chars": 5740,
"preview": "{\n \"name\": \"azure-ai\",\n \"version\": \"1.0.0\",\n \"description\": \"Azure AI Content Safety and PII Detection plugins for co"
},
{
"path": "plugins/azure/pii.ts",
"chars": 4473,
"preview": "import { Agent } from 'https';\nimport {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '."
},
{
"path": "plugins/azure/protectedMaterial.ts",
"chars": 3220,
"preview": "import { HookEventType, PluginContext, PluginParameters } from '../types';\nimport { post, getText } from '../utils';\nimp"
},
{
"path": "plugins/azure/shieldPrompt.ts",
"chars": 3903,
"preview": "import { HookEventType, PluginContext, PluginParameters } from '../types';\nimport { post, getText, getCurrentContentPart"
},
{
"path": "plugins/azure/types.ts",
"chars": 220,
"preview": "export interface AzureCredentials {\n resourceName: string;\n azureAuthMode: 'apiKey' | 'entra' | 'managed';\n apiKey?: "
},
{
"path": "plugins/azure/utils.ts",
"chars": 3839,
"preview": "import { AzureCredentials } from './types';\n\nconst cacheExpiry = 15 * 60; // 15 minutes\n\nexport async function getAccess"
},
{
"path": "plugins/bedrock/bedrock.test.ts",
"chars": 8553,
"preview": "import { HookEventType, PluginContext, PluginParameters } from '../types';\nimport { pluginHandler } from './index';\nimpo"
},
{
"path": "plugins/bedrock/index.ts",
"chars": 6312,
"preview": "import { PluginHandler } from '../types';\nimport {\n getCurrentContentPart,\n HttpError,\n setCurrentContentPart,\n} from"
},
{
"path": "plugins/bedrock/manifest.json",
"chars": 2245,
"preview": "{\n \"id\": \"bedrock\",\n \"description\": \"AWS Bedrock Content Moderation classifier leverages AWS guardrails for effective "
},
{
"path": "plugins/bedrock/type.ts",
"chars": 2457,
"preview": "export type BedrockAccessKeyCreds = {\n awsAuthType?: 'accessKey';\n awsAccessKeyId: string;\n awsSecretAccessKey: strin"
},
{
"path": "plugins/bedrock/util.ts",
"chars": 7136,
"preview": "import { Sha256 } from '@aws-crypto/sha256-js';\nimport { SignatureV4 } from '@smithy/signature-v4';\nimport { BedrockBody"
},
{
"path": "plugins/build.ts",
"chars": 1126,
"preview": "import conf from '../conf.json';\nimport fs from 'fs';\n\nconst pluginsEnabled = conf.plugins_enabled;\n\nlet importStrings: "
},
{
"path": "plugins/crowdstrike-aidr/aidr.test.ts",
"chars": 3375,
"preview": "import { handler } from './guardChatCompletion';\nimport testCredsFile from './.creds.json';\nimport { HookEventType, Plug"
},
{
"path": "plugins/crowdstrike-aidr/guardChatCompletion.ts",
"chars": 3310,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { post, HttpEr"
},
{
"path": "plugins/crowdstrike-aidr/manifest.json",
"chars": 958,
"preview": "{\n \"id\": \"crowdstrike-aidr\",\n \"description\": \"CrowdStrike AIDR for scanning LLM inputs and outputs\",\n \"credentials\": "
},
{
"path": "plugins/crowdstrike-aidr/version.ts",
"chars": 38,
"preview": "export const VERSION = 'v1.0.0-beta';\n"
},
{
"path": "plugins/default/addPrefix.ts",
"chars": 6843,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getCurrentCo"
},
{
"path": "plugins/default/alllowercase.ts",
"chars": 1713,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getText } fr"
},
{
"path": "plugins/default/allowedRequestTypes.ts",
"chars": 6282,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\n\nexport const handler"
},
{
"path": "plugins/default/alluppercase.ts",
"chars": 1713,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getText } fr"
},
{
"path": "plugins/default/characterCount.ts",
"chars": 2312,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getText } fr"
},
{
"path": "plugins/default/contains.ts",
"chars": 1963,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getText } fr"
},
{
"path": "plugins/default/containsCode.ts",
"chars": 3141,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getText } fr"
},
{
"path": "plugins/default/default.test.ts",
"chars": 114854,
"preview": "import { handler as regexMatchHandler } from './regexMatch';\nimport { handler as jsonSchemaHandler } from './jsonSchema'"
},
{
"path": "plugins/default/endsWith.ts",
"chars": 1716,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getText } fr"
},
{
"path": "plugins/default/jsonKeys.ts",
"chars": 4912,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getText } fr"
},
{
"path": "plugins/default/jsonSchema.ts",
"chars": 3799,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { Validator } "
},
{
"path": "plugins/default/jwt.ts",
"chars": 3478,
"preview": "import { PluginContext, PluginHandler, PluginParameters } from '../types';\nimport { jwtVerify, importJWK, JWTHeaderParam"
},
{
"path": "plugins/default/log.ts",
"chars": 707,
"preview": "import { PluginContext, PluginHandler, PluginParameters } from '../types';\nimport { post } from '../utils';\n\nexport cons"
},
{
"path": "plugins/default/manifest.json",
"chars": 27838,
"preview": "{\n \"id\": \"default\",\n \"name\": \"Default\",\n \"description\": \"The default set of guardrail functions available in the AI G"
},
{
"path": "plugins/default/modelRules.ts",
"chars": 3381,
"preview": "import type {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\n\ninterface Rules"
},
{
"path": "plugins/default/modelWhitelist.ts",
"chars": 1532,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\n\nexport const handler"
},
{
"path": "plugins/default/notNull.ts",
"chars": 1419,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getCurrentCo"
},
{
"path": "plugins/default/regexMatch.ts",
"chars": 2121,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getText } fr"
},
{
"path": "plugins/default/regexReplace.ts",
"chars": 2726,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getCurrentCo"
},
{
"path": "plugins/default/requiredMetadataKeys.ts",
"chars": 3331,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginHandlerResponse,\n PluginParameters,\n} from '../type"
},
{
"path": "plugins/default/sentenceCount.ts",
"chars": 2078,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getText } fr"
},
{
"path": "plugins/default/validUrls.ts",
"chars": 4997,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getText } fr"
},
{
"path": "plugins/default/webhook.ts",
"chars": 3369,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { post, Timeou"
},
{
"path": "plugins/default/wordCount.ts",
"chars": 2233,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getText } fr"
},
{
"path": "plugins/exa/exa.test.ts",
"chars": 11868,
"preview": "import testCreds from './.creds.json';\nimport { handler as onlineHandler } from './online';\nimport { PluginContext } fro"
},
{
"path": "plugins/exa/manifest.json",
"chars": 2961,
"preview": "{\n \"id\": \"exa\",\n \"description\": \"Exa.ai integration for enhancing AI responses with real-time web search information\","
},
{
"path": "plugins/exa/online.ts",
"chars": 5754,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport { getCurrentCo"
},
{
"path": "plugins/f5-guardrails/manifest.json",
"chars": 2179,
"preview": "{\n \"id\": \"f5-guardrails\",\n \"description\": \"F5 Guardrails Plugin - Partner guardrail powered by F5 Guardrails\",\n \"cred"
},
{
"path": "plugins/f5-guardrails/scan.test.ts",
"chars": 1828,
"preview": "import { handler } from './scan';\nimport testCreds from './.creds.json';\nimport { PluginContext } from '../types';\n\ndesc"
},
{
"path": "plugins/f5-guardrails/scan.ts",
"chars": 3533,
"preview": "import {\n HookEventType,\n PluginContext,\n PluginHandler,\n PluginParameters,\n} from '../types';\nimport {\n post,\n ge"
}
]
// ... and 524 more files (download for full content)
About this extraction
This page contains the full source code of the Portkey-AI/gateway GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 724 files (25.3 MB), approximately 6.7M tokens, and a symbol index with 1459 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.