Last updated: June 2026
OCI Functions and API Gateway cost optimization starts with the free allowances: 2 million function invocations and 1 million API calls per month cost nothing. Beyond that, the biggest lever is right-sizing function memory and shortening execution time, because Functions bills by gigabyte-seconds, which is memory multiplied by duration. Consolidate sparse API gateways and cache repeated responses to keep call volume down.
- Functions: 2 million free invocations and 400,000 free gigabyte-seconds per month.
- API Gateway: 1 million free calls per month, then about $3.00 per million.
- Right-size memory and cut run time; the resource charge is memory times duration.
- Consolidate gateways and cache responses to reduce billed calls.
OCI Functions is Oracle Cloud's serverless Functions-as-a-Service platform, billed per invocation and per gigabyte-second of memory-time, and OCI API Gateway is its managed front door, billed per million API calls. Optimizing OCI serverless cost is mostly about staying inside the generous free allowances, right-sizing memory and run time, and not multiplying per-call charges across redundant gateways. This article is part of our Oracle Cloud cluster; the pillar it links up to is the complete guide to Oracle Cloud cost optimization. Serverless right-sizing is a Cut step in our See, Cut, Lock, Run method: trim and tune before you ever consider committing.
How is OCI Functions billed?
OCI Functions is billed on two dimensions, the number of invocations and the resources consumed, where resource use is measured in gigabyte-seconds of memory multiplied by execution time. As of June 2026, per the Oracle Cloud Functions page, the first 2 million invocations and 400,000 gigabyte-seconds per month are free; beyond that, invocations cost about $0.0000002 each (roughly $0.20 per million) and resources are billed per gigabyte-second. The practical consequence is that a function set to 1 GB of memory that runs for two seconds costs the same in resources as one set to 2 GB running for one second, so memory and duration are the two dials that matter. Verify the current figures on the linked Oracle page before acting, because serverless rates change.
| Service | Free monthly allowance | Beyond free | Main cost lever |
|---|---|---|---|
| OCI Functions | 2M invocations + 400,000 GB-seconds | ~$0.0000002 per invocation + per GB-second | Memory shape and execution time |
| OCI API Gateway | 1M API calls | ~$3.00 per million calls | Call volume and gateway count |
How do you reduce OCI serverless costs, step by step?
These five steps keep low-volume workloads free and trim the resource charge on the rest.
- Stay inside the free monthly allowancesTrack usage against the 2 million free invocations and 1 million free API calls per month. The result is that low-volume functions and gateways stay at zero cost rather than tipping into billed usage unnoticed.
- Right-size function memoryLower each function to the smallest memory shape that still meets its latency target. The result is a directly proportional cut to the gigabyte-second charge, since resources bill as memory times duration.
- Shorten execution timeReduce cold starts and slow code paths so each invocation runs for fewer seconds. The result is fewer gigabyte-seconds per call and a lower bill at the same request volume.
- Consolidate API Gateway deploymentsMerge sparse gateways and route through shared deployments. The result is that you stop spreading per-call charges across redundant gateways doing little work each.
- Cache and batch at the gatewayUse response caching and request batching so repeated calls do not each trigger a billed invocation and API call. The result is a lower effective call count for the same user traffic.
Serverless bill creeping past the free tier?
Our Oracle Cloud cost audit profiles every function's memory and run time, finds the over-provisioned shapes, and consolidates redundant gateways. On the performance model you pay only from realized savings. No savings, no fee.
Book an OCI cost audit →How much does OCI API Gateway cost?
OCI API Gateway gives the first 1 million API calls per month free, then bills roughly $3.00 per million calls, with no separate charge for gateway instances, deployments, or idle time. That means the only variable on the bill is call volume, so the cost question is entirely about how many calls your front door actually handles. Two patterns drive call volume up needlessly: redundant gateways that each carry a slice of traffic, and uncached endpoints that re-run the same lookup on every request. Consolidating deployments behind one gateway and caching stable responses both cut the billed call count without changing what users experience. Because API Gateway often sits in front of Functions, the two optimizations compound: fewer gateway calls means fewer function invocations behind them. The same right-size-then-consolidate logic runs through our Oracle Cloud cost optimization work across every service.
Is OCI serverless cheaper than running a VM?
For spiky or low-volume workloads, OCI Functions and API Gateway are usually cheaper than an always-on VM, because you pay only per invocation and per call and the free allowances often cover the workload entirely. The break-even shifts as traffic becomes steady and high-volume: at that point per-invocation pricing can exceed the cost of a right-sized, always-on instance, and a small Arm-based compute shape becomes the cheaper home for the workload. The decision rule is to keep bursty and event-driven work on serverless and move sustained high-throughput services to compute. For the compute side of that trade, our guide on OCI compute savings with Ampere A1 Arm instances covers where steady workloads run cheapest, and the networking front door is covered in our sibling guide on how to optimize OCI Load Balancer and networking costs.
Free allowances, per-invocation and per-call rates, and the gigabyte-second billing model reflect Oracle Cloud as of June 2026. Verify current rates and behavior on the linked Oracle documentation before acting, because serverless pricing and policies change.
The OCI Cost Optimization Field Guide includes the serverless right-sizing worksheet and the gateway-consolidation checklist we apply on engagements. It is the downloadable companion to this article.
Frequently asked questions
How is OCI Functions billed?
OCI Functions is billed on two dimensions: the number of invocations and the resources consumed, measured in gigabyte-seconds of memory multiplied by execution time. The first 2 million invocations and 400,000 gigabyte-seconds per month are free, after which invocations cost about $0.0000002 each and resource use is billed per gigabyte-second. Because resource cost is memory times duration, the largest lever is right-sizing memory and shortening run time. Verify current rates on the Oracle pricing page.
How much does OCI API Gateway cost?
OCI API Gateway gives the first 1 million API calls per month free, with calls beyond that billed at roughly $3.00 per million. There is no separate charge for gateway instances, deployments, or idle time, so the only variable is call volume. Consolidating deployments and caching repeated responses are the main ways to keep call volume, and therefore cost, down.
How do I reduce OCI Functions cost?
Right-size each function to the smallest memory shape that meets its latency target and shorten execution time, because Functions bills by gigabyte-seconds, which is memory multiplied by duration. Halving the memory or the run time roughly halves the resource charge. Staying within the 2 million free invocations and 400,000 free gigabyte-seconds keeps low-volume functions free entirely.
Is OCI serverless cheaper than running a VM?
For spiky or low-volume workloads, OCI Functions and API Gateway are usually cheaper than an always-on VM because you pay only per invocation and per call, and the generous free allowances often cover the workload entirely. For steady high-volume traffic, a right-sized Arm-based compute instance can be cheaper because it avoids per-invocation pricing, so the decision depends on volume and traffic shape.
The short version
OCI serverless savings are mechanical: stay inside the free invocation and API-call allowances, right-size function memory, shorten execution time, consolidate sparse gateways, and cache repeated responses. When you want the functions profiled and the gateways consolidated for you, that is exactly what our OCI cost optimization service delivers.
Cloud pricing and service behavior change frequently. Verify the specifics in this guide against the providers’ own current documentation and the FinOps Foundation: Oracle Cloud pricing ↗, Oracle Cloud Infrastructure documentation ↗ and FinOps Foundation Framework ↗. This article also reflects Cloud Cost Room’s hands-on, vendor-neutral engagement experience.