{"id":23854956,"url":"https://github.com/gabrielkoo/bedrock-access-gateway-function-url","last_synced_at":"2025-06-11T05:05:27.013Z","repository":{"id":270604044,"uuid":"910883010","full_name":"gabrielkoo/bedrock-access-gateway-function-url","owner":"gabrielkoo","description":"OpenAI-Compatible RESTful APIs for Amazon Bedrock, modified from the original \"bedrock-access-gateway\" project for not using ALB, so that one could deploy and use it under a pay as you go model WITH NO FIXED COSTS.","archived":false,"fork":false,"pushed_at":"2025-05-31T18:14:37.000Z","size":232,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-31T23:04:42.490Z","etag":null,"topics":["bedrock","genai","openai","openai-api","openai-proxy","pay-as-you-go","proxy","sam","serverless"],"latest_commit_sha":null,"homepage":"https://dev.to/aws-builders/use-amazon-bedrock-models-via-an-openai-api-compatible-serverless-endpoint-now-without-fixed-cost-5hf5","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gabrielkoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-01T17:53:12.000Z","updated_at":"2025-05-31T18:14:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"4056b59e-c274-4d85-a3c1-78dd2074ffea","html_url":"https://github.com/gabrielkoo/bedrock-access-gateway-function-url","commit_stats":null,"previous_names":["gabrielkoo/bedrock-access-gateway-function-url"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielkoo%2Fbedrock-access-gateway-function-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielkoo%2Fbedrock-access-gateway-function-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielkoo%2Fbedrock-access-gateway-function-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielkoo%2Fbedrock-access-gateway-function-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gabrielkoo","download_url":"https://codeload.github.com/gabrielkoo/bedrock-access-gateway-function-url/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gabrielkoo%2Fbedrock-access-gateway-function-url/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259204800,"owners_count":22821159,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bedrock","genai","openai","openai-api","openai-proxy","pay-as-you-go","proxy","sam","serverless"],"created_at":"2025-01-03T00:19:16.434Z","updated_at":"2025-06-11T05:05:27.005Z","avatar_url":"https://github.com/gabrielkoo.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bedrock-access-gateway-function-url\n\n# Why not XXX?\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eSolution\u003c/th\u003e\n      \u003cth\u003ePros \u0026amp; Cons\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eLiteLLM\u003c/strong\u003e (Python SDK)\u003c/td\u003e\n      \u003ctd\u003e\n        (-) \u003ca href=\"https://github.com/BerriAI/litellm/blob/d77b825814c354935ac540c8f8b4b696f23d83c9/pyproject.toml#L21-L61\"\u003efull list of unnecessary dependencies\u003c/a\u003e potentially bloating your Python environment/application, e.g., \u003ccode\u003egunicorn\u003c/code\u003e, \u003ccode\u003efastapi\u003c/code\u003e, \u003ccode\u003egoogle-cloud-kms\u003c/code\u003e, etc.\u003cbr\u003e\n        (-) Python Only\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eLiteLLM\u003c/strong\u003e (Proxy)\u003c/td\u003e\n      \u003ctd\u003e\n        (-) Huge Infra Cost (Worker + Database + Redis)\u003cbr\u003e\n        (-) \u003ca href=\"https://docs.litellm.ai/docs/proxy/deploy#platform-specific-guide\"\u003eGood luck with maintaining \u003ccode\u003edocker-compose\u003c/code\u003e / K8S\u003c/a\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003ebedrock-access-gateway\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        (-) \u0026gt;US$16/month\u003cbr\u003e\n        (-) Extra Load Balancer needed + Fargate/Lambda pricing\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eaisuite\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        (+) No bloatware issue with usage of \u003ccode\u003eextra\u003c/code\u003e Python dependencies\u003cbr\u003e\n        (+) No extra infra cost\u003cbr\u003e\n        (-) Python Only\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003cstrong\u003eThis Solution\u003c/strong\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        (+) Only minimal pay-as-you-go Lambda exec costs\u003cbr\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n## Intro\n\nThis repo is combining the great works of the original implementations of [bedrock-access-gateway](https://github.com/aws-samples/bedrock-access-gateway/) with [aws-lambda-web-adapter](https://github.com/awslabs/aws-lambda-web-adapter) so that one can deploy an OpenAI API compatible endpoint on AWS Lambda with Function URL and streaming enabled.\n\nThis solution is more cost effective than the original `bedrock-access-gateway` solution as it removes the need of fixed cost components (Application Load Balancer and the optional Fargate container, \u003eUS$16/month) and the need of a VPC. So that one can use it in a fully pay-as-you-go model.\n\nIt also removes the usage of a Lambda Docker runtime to avoid the use of a ECR repository in order to reduce Lambda cold start times.\n\nRead more on the creation of this project [here](https://dev.to/aws-builders/use-amazon-bedrock-models-via-an-openai-api-compatible-serverless-endpoint-now-without-fixed-cost-5hf5).\n\n## Changes from the Original Access Gateway\n\n- Removes Application Load Balancer -\u003e Lambda Function URL\n- Docker Lambda Runtime -\u003e Python Lambda Runtime\n- Optionally removes `numpy` and `tiktoken` dependencies when embedding models are not needed\n- Deployment option with CloudShell -\u003e Fast and efficient!\n\n## Deployment\n\nDependency: an AWS Account with Bedrock model access enabled in the region you want to deploy this solution.\n\nUnder both deployment options, `--no-embeddings` is optional. If you want to speed up the inference as well as reduce the Lambda Layer, you can exclude the embeddings from the deployment package.\n\nHowever for simplicify, CloudShell deployment method is recommended as it is faster and you do not need to worry about installing the dependencies on your local machine.\n\n- Local: Make sure you have docker as well as AWS SAM CLI installed and configured with your AWS credentials.\n- AWS CloudShell: If you are using a VPC environment, make sure it has access to the internet.\n\n```shell\ngit clone --depth=1 https://github.com/gabrielkoo/bedrock-access-gateway-function-url\ncd bedrock-access-gateway-function-url\n\n./deploy.sh\n# Optional: If you want to speed up the inference as well as reduce the Lambda Layer, you can exclude the embeddings from the deployment package.\n# ./deploy.sh --no-embeddings\n```\n\n\u003cdetails\u003e\n\u003csummary\u003eSample deploy logs (CloudShell)\u003c/summary\u003e\n\n```\n~ $ git clone --depth=1 https://github.com/gabrielkoo/bedrock-access-gateway-function-url\nCloning into 'bedrock-access-gateway-function-url'...\nremote: Enumerating objects: 20, done.\nremote: Counting objects: 100% (20/20), done.\nremote: Compressing objects: 100% (16/16), done.\nremote: Total 20 (delta 0), reused 7 (delta 0), pack-reused 0 (from 0)\nReceiving objects: 100% (20/20), 163.70 KiB | 10.23 MiB/s, done.\n~ $ cd bedrock-access-gateway-function-url\nbedrock-access-gateway-function-url $\nbedrock-access-gateway-function-url $ ./deploy.sh --no-embeddings\nYou are running in AWS CloudShell, installing Python 3.12...\nnodejs20                                           3.1 MB/s |  47 kB     00:00\nAmazon Linux 2023 repository                        58 MB/s |  38 MB     00:00\nDependencies resolved.\nNothing to do.\nComplete!\nLast metadata expiration check: 0:00:11 ago on Sat 31 May 2025 01:22:30 PM UTC.\nDependencies resolved.\n=========================================================================================\n Package                  Architecture  Version                      Repository     Size\n=========================================================================================\nInstalling:\n python3.12               x86_64        3.12.10-2.amzn2023.0.1       amazonlinux     28 k\n python3.12-pip           noarch        23.2.1-4.amzn2023.0.2        amazonlinux    2.8 M\nInstalling dependencies:\n mpdecimal                x86_64        2.5.1-3.amzn2023.0.3         amazonlinux    101 k\n python3.12-libs          x86_64        3.12.10-2.amzn2023.0.1       amazonlinux    9.0 M\n python3.12-pip-wheel     noarch        23.2.1-4.amzn2023.0.2        amazonlinux    1.5 M\nInstalling weak dependencies:\n python3.12-setuptools    noarch        68.2.2-4.amzn2023.0.2        amazonlinux    1.4 M\n\nTransaction Summary\n=========================================================================================\nInstall  6 Packages\n\nTotal download size: 15 M\nInstalled size: 63 M\nDownloading Packages:\n(1/6): python3.12-3.12.10-2.amzn2023.0.1.x86_64.rpm            1.3 MB/s |  28 kB     00:00\n(2/6): mpdecimal-2.5.1-3.amzn2023.0.3.x86_64.rpm               3.0 MB/s | 101 kB     00:00\n(3/6): python3.12-pip-23.2.1-4.amzn2023.0.2.noarch.rpm          48 MB/s | 2.8 MB     00:00\n(4/6): python3.12-pip-wheel-23.2.1-4.amzn2023.0.2.noarch.rpm    28 MB/s | 1.5 MB     00:00\n(5/6): python3.12-libs-3.12.10-2.amzn2023.0.1.x86_64.rpm        58 MB/s | 9.0 MB     00:00\n(6/6): python3.12-setuptools-68.2.2-4.amzn2023.0.2.noarch.rpm   20 MB/s | 1.4 MB     00:00\n------------------------------------------------------------------------------------------\nTotal                                                           32 MB/s |  15 MB     00:00\nRunning transaction check\nTransaction check succeeded.\nRunning transaction test\nTransaction test succeeded.\nRunning transaction\n  Preparing        :                                                      1/1\n  Installing       : python3.12-pip-wheel-23.2.1-4.amzn2023.0.2.noarch    1/6\n  Installing       : mpdecimal-2.5.1-3.amzn2023.0.3.x86_64                2/6\n  Installing       : python3.12-3.12.10-2.amzn2023.0.1.x86_64             3/6\n  Installing       : python3.12-libs-3.12.10-2.amzn2023.0.1.x86_64        4/6\n  Installing       : python3.12-setuptools-68.2.2-4.amzn2023.0.2.noarch   5/6\n  Installing       : python3.12-pip-23.2.1-4.amzn2023.0.2.noarch          6/6\n  Running scriptlet: python3.12-pip-23.2.1-4.amzn2023.0.2.noarch          6/6\n  Verifying        : mpdecimal-2.5.1-3.amzn2023.0.3.x86_64                1/6\n  Verifying        : python3.12-3.12.10-2.amzn2023.0.1.x86_64             2/6\n  Verifying        : python3.12-libs-3.12.10-2.amzn2023.0.1.x86_64        3/6\n  Verifying        : python3.12-pip-23.2.1-4.amzn2023.0.2.noarch          4/6\n  Verifying        : python3.12-pip-wheel-23.2.1-4.amzn2023.0.2.noarch    5/6\n  Verifying        : python3.12-setuptools-68.2.2-4.amzn2023.0.2.noarch   6/6\nInstalled:\n  mpdecimal-2.5.1-3.amzn2023.0.3.x86_64\n  python3.12-3.12.10-2.amzn2023.0.1.x86_64\n  python3.12-libs-3.12.10-2.amzn2023.0.1.x86_64\n  python3.12-pip-23.2.1-4.amzn2023.0.2.noarch\n  python3.12-pip-wheel-23.2.1-4.amzn2023.0.2.noarch\n  python3.12-setuptools-68.2.2-4.amzn2023.0.2.noarch\n\nComplete!\n14 files removed\nCloning aws-samples/bedrock-access-gateway repository\nCloning into 'build/bedrock-access-gateway'...\nremote: Enumerating objects: 49, done.\nremote: Counting objects: 100% (49/49), done.\nremote: Compressing objects: 100% (47/47), done.\nremote: Total 49 (delta 2), reused 15 (delta 0), pack-reused 0 (from 0)\nReceiving objects: 100% (49/49), 186.95 KiB | 11.68 MiB/s, done.\nResolving deltas: 100% (2/2), done.\nDeleting embeddings related code and dependencies\nWARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.\nWARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.\nBuilding layer 'BedrockAccessGatewayLayer'\n Running PythonPipBuilder:ResolveDependencies\n Running PythonPipBuilder:CopySource\nBuilding codeuri: /home/cloudshell-user/bedrock-access-gateway-function-url/app runtime: python3.12 architecture: x86_64 functions: BedrockAccessGatewayFunction\nrequirements.txt file not found. Continuing the build without dependencies.\n Running PythonPipBuilder:CopySource\n\nBuild Succeeded\n\nBuilt Artifacts  : .aws-sam/build\nBuilt Template   : .aws-sam/build/template.yaml\n\nCommands you can use next\n=========================\n[*] Validate SAM template: sam validate\n[*] Invoke Function: sam local invoke\n[*] Test Function in the Cloud: sam sync --stack-name {{stack-name}} --watch\n[*] Deploy: sam deploy --guided\n\nConfiguring SAM deploy\n======================\n\n        Looking for config file [samconfig.toml] :  Not found\n\n        Setting default arguments for 'sam deploy'\n        =========================================\n        Stack Name [sam-app]:\n        AWS Region [us-east-1]: us-west-2\n        Parameter LambdaAdapterLayerVersion [25]:\n        Parameter PythonRuntime [python3.12]:\n        Parameter ApiKey []: API_KEY_HERE\n        Parameter DefaultModel [amazon.nova-premier-v1:0]:\n        Parameter DEBUG [false]:\n        #Shows you resources changes to be deployed and require a 'Y' to initiate deploy\n        Confirm changes before deploy [y/N]:\n        #SAM needs permission to be able to create roles to connect to the resources in your template\n        Allow SAM CLI IAM role creation [Y/n]:\n        #Preserves the state of previously provisioned resources when an operation fails\n        Disable rollback [y/N]:\n        BedrockAccessGatewayFunction Function Url has no authentication. Is this okay? [y/N]: Y\n        Save arguments to configuration file [Y/n]: y\n        SAM configuration file [samconfig.toml]:\n        SAM configuration environment [default]:\n\n        Looking for resources needed for deployment:\n\n        Managed S3 bucket: aws-sam-cli-managed-default-samclisourcebucket-randomstringhere\n        A different default S3 bucket can be set in samconfig.toml and auto resolution of buckets turned off by setting resolve_s3=False\n\n        Saved arguments to config file\n        Running 'sam deploy' for future deployments will use the parameters saved above.\n        The above parameters can be changed by modifying samconfig.toml\n        Learn more about samconfig.toml syntax at\n        https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-config.html\n\n        Uploading to sam-app/e49572af63df1fee8385ee6fd07ad13f  17667095 / 17667095  (100.00%)\n        Uploading to sam-app/52b5888e3d442f70bba8f69c14b22593  13478 / 13478  (100.00%)\n\n        Deploying with following values\n        ===============================\n        Stack name                   : sam-app\n        Region                       : us-west-2\n        Confirm changeset            : False\n        Disable rollback             : False\n        Deployment s3 bucket         : aws-sam-cli-managed-default-samclisourcebucket-randomstringhere\n        Capabilities                 : [\"CAPABILITY_IAM\"]\n        Parameter overrides          : {\"LambdaAdapterLayerVersion\": \"25\", \"PythonRuntime\": \"python3.12\", \"ApiKey\": \"API_KEY_HERE\", \"DefaultModel\": \"amazon.nova-premier-v1:0\", \"DEBUG\": \"false\"}\n        Signing Profiles             : {}\n\nInitiating deployment\n=====================\n\n        Uploading to sam-app/30655654d4ae6f15e1f097af6c6641bf.template  4066 / 4066  (100.00%)\n\n\nWaiting for changeset to be created..\n\nCloudFormation stack changeset\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nOperation                                                   LogicalResourceId                                           ResourceType                                                Replacement\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n+ Add                                                       BedrockAccessGatewayFunctionRole                            AWS::IAM::Role                                              N/A\n+ Add                                                       BedrockAccessGatewayFunctionUrlPublicPermissions            AWS::Lambda::Permission                                     N/A\n+ Add                                                       BedrockAccessGatewayFunctionUrl                             AWS::Lambda::Url                                            N/A\n+ Add                                                       BedrockAccessGatewayFunction                                AWS::Lambda::Function                                       N/A\n+ Add                                                       BedrockAccessGatewayLayer712ebcdcd1                         AWS::Lambda::LayerVersion                                   N/A\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n\nChangeset created successfully. arn:aws:cloudformation:us-west-2:AWS_ACCOUNT_ID:changeSet/samcli-deploy1748697858/b08c3804-666a-43dc-b875-8d61c703d1ef\n\n\n2025-05-31 13:24:25 - Waiting for stack create/update to complete\n\nCloudFormation events from stack operations (refresh every 5.0 seconds)\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nResourceStatus                                              ResourceType                                                LogicalResourceId                                           ResourceStatusReason\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nCREATE_IN_PROGRESS                                          AWS::CloudFormation::Stack                                  sam-app                                                     User Initiated\nCREATE_IN_PROGRESS                                          AWS::Lambda::LayerVersion                                   BedrockAccessGatewayLayer712ebcdcd1                         -\nCREATE_IN_PROGRESS                                          AWS::IAM::Role                                              BedrockAccessGatewayFunctionRole                            -\nCREATE_IN_PROGRESS                                          AWS::IAM::Role                                              BedrockAccessGatewayFunctionRole                            Resource creation Initiated\nCREATE_IN_PROGRESS                                          AWS::Lambda::LayerVersion                                   BedrockAccessGatewayLayer712ebcdcd1                         Resource creation Initiated\nCREATE_COMPLETE                                             AWS::Lambda::LayerVersion                                   BedrockAccessGatewayLayer712ebcdcd1                         -\nCREATE_COMPLETE                                             AWS::IAM::Role                                              BedrockAccessGatewayFunctionRole                            -\nCREATE_IN_PROGRESS                                          AWS::Lambda::Function                                       BedrockAccessGatewayFunction                                -\nCREATE_IN_PROGRESS                                          AWS::Lambda::Function                                       BedrockAccessGatewayFunction                                Resource creation Initiated\nCREATE_IN_PROGRESS - CONFIGURATION_COMPLETE                 AWS::Lambda::Function                                       BedrockAccessGatewayFunction                                Eventual consistency check initiated\nCREATE_IN_PROGRESS                                          AWS::Lambda::Permission                                     BedrockAccessGatewayFunctionUrlPublicPermissions            -\nCREATE_IN_PROGRESS                                          AWS::Lambda::Url                                            BedrockAccessGatewayFunctionUrl                             -\nCREATE_IN_PROGRESS                                          AWS::Lambda::Permission                                     BedrockAccessGatewayFunctionUrlPublicPermissions            Resource creation Initiated\nCREATE_IN_PROGRESS                                          AWS::Lambda::Url                                            BedrockAccessGatewayFunctionUrl                             Resource creation Initiated\nCREATE_COMPLETE                                             AWS::Lambda::Permission                                     BedrockAccessGatewayFunctionUrlPublicPermissions            -\nCREATE_COMPLETE                                             AWS::Lambda::Url                                            BedrockAccessGatewayFunctionUrl                             -\nCREATE_COMPLETE                                             AWS::Lambda::Function                                       BedrockAccessGatewayFunction                                -\nCREATE_COMPLETE                                             AWS::CloudFormation::Stack                                  sam-app                                                     -\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nCloudFormation outputs from deployed stack\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nOutputs\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\nKey                 Function\nDescription         FastAPI Lambda Function ARN\nValue               arn:aws:lambda:us-west-2:AWS_ACCOUNT_ID:function:sam-app-BedrockAccessGatewayFunction-MmH86RyCulkr\n\nKey                 FunctionUrl\nDescription         Function URL for FastAPI function\nValue               https://RANDOM_STRING_HERE.lambda-url.us-west-2.on.aws/\n\nKey                 SampleCurlCommand\nDescription         Sample curl command to list available models\nValue               curl -X GET https://RANDOM_STRING_HERE.lambda-url.us-west-2.on.aws/api/v1/models -H 'Authorization: Bearer API_KEY_HERE'\n----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n\nSuccessfully created/updated stack - sam-app in us-west-2\n```\n\n\u003c/details\u003e\n\n## Test\n\nEnter your credentials on my static hosted UI \u003chttps://chat.gab.hk/\u003e,\n![Test UI](./docs/test-ui.png)\n\nor just run the code below in your shell:\n\n```shell\n# 1. List the models available in your Bedrock account\ncurl \"${FUNCTION_URL}api/v1/models\" \\\n     -H \"Authorization: Bearer $API_KEY\"\n\n# \u003e {\n# \u003e     \"object\": \"list\",\n# \u003e     \"data\": [\n# \u003e         {\n# \u003e             \"id\": \"amazon.titan-tg1-large\",\n# \u003e             \"created\": 1748694923,\n# \u003e             \"object\": \"model\",\n# \u003e             \"owned_by\": \"bedrock\"\n# \u003e         },\n# \u003e         {\n# \u003e             \"id\": \"us.amazon.nova-premier-v1:0\",\n# \u003e             \"created\": 1748694923,\n# \u003e             \"object\": \"model\",\n# \u003e             \"owned_by\": \"bedrock\"\n# \u003e         },\n# \u003e         ...\n# \u003e     ]\n# \u003e }\n\n# 2. Make a chat completion request\ncurl \"${FUNCTION_URL}api/v1/chat/completions\" \\\n     -H \"Authorization: Bearer $API_KEY\" \\\n     -X POST \\\n     -H 'Content-Type: application/json' \\\n     -d '{\n        \"stream\": true,\n        \"model\": \"amazon.nova-micro-v1:0\",\n        \"messages\": [{\"role\": \"user\", \"content\": \"Tell me what is 1+1\"}]\n    }'\n\n# \u003e data: {\"id\":\"chatcmpl-61c29444\",\"created\":1735753748,\"model\":\"amazon.nova-micro-v1:0\",\"system_fingerprint\":\"fp\",\"choices\":[{\"index\":0,\"finish_reason\":null,\"logprobs\":null,\"delta\":{\"role\":\"assistant\",\"content\":\"\"}}],\"object\":\"chat.completion.chunk\",\"usage\":null}\n# \u003e data: {\"id\":\"chatcmpl-61c29444\",\"created\":1735753748,\"model\":\"amazon.nova-micro-v1:0\",\"system_fingerprint\":\"fp\",\"choices\":[{\"index\":0,\"finish_reason\":null,\"logprobs\":null,\"delta\":{\"content\":\"\"}}],\"object\":\"chat.completion.chunk\",\"usage\":null}\n# \u003e data: {\"id\":\"chatcmpl-61c29444\",\"created\":1735753748,\"model\":\"amazon.nova-micro-v1:0\",\"system_fingerprint\":\"fp\",\"choices\":[{\"index\":0,\"finish_reason\":null,\"logprobs\":null,\"delta\":{\"content\":\"1\"}}],\"object\":\"chat.completion.chunk\",\"usage\":null}\n# \u003e data: {\"id\":\"chatcmpl-61c29444\",\"created\":1735753748,\"model\":\"amazon.nova-micro-v1:0\",\"system_fingerprint\":\"fp\",\"choices\":[{\"index\":0,\"finish_reason\":null,\"logprobs\":null,\"delta\":{\"content\":\"+\"}}],\"object\":\"chat.completion.chunk\",\"usage\":null}\n# \u003e data: {\"id\":\"chatcmpl-61c29444\",\"created\":1735753748,\"model\":\"amazon.nova-micro-v1:0\",\"system_fingerprint\":\"fp\",\"choices\":[{\"index\":0,\"finish_reason\":null,\"logprobs\":null,\"delta\":{\"content\":\"1\"}}],\"object\":\"chat.completion.chunk\",\"usage\":null}\n# \u003e data: {\"id\":\"chatcmpl-61c29444\",\"created\":1735753748,\"model\":\"amazon.nova-micro-v1:0\",\"system_fingerprint\":\"fp\",\"choices\":[{\"index\":0,\"finish_reason\":null,\"logprobs\":null,\"delta\":{\"content\":\" equals\"}}],\"object\":\"chat.completion.chunk\",\"usage\":null}\n# \u003e data: {\"id\":\"chatcmpl-61c29444\",\"created\":1735753748,\"model\":\"amazon.nova-micro-v1:0\",\"system_fingerprint\":\"fp\",\"choices\":[{\"index\":0,\"finish_reason\":null,\"logprobs\":null,\"delta\":{\"content\":\"\"}}],\"object\":\"chat.completion.chunk\",\"usage\":null}\n# \u003e data: {\"id\":\"chatcmpl-61c29444\",\"created\":1735753748,\"model\":\"amazon.nova-micro-v1:0\",\"system_fingerprint\":\"fp\",\"choices\":[{\"index\":0,\"finish_reason\":null,\"logprobs\":null,\"delta\":{\"content\":\" 2\"}}],\"object\":\"chat.completion.chunk\",\"usage\":null}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielkoo%2Fbedrock-access-gateway-function-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgabrielkoo%2Fbedrock-access-gateway-function-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgabrielkoo%2Fbedrock-access-gateway-function-url/lists"}