diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst
index 5f6500b..5d39e45 100644
--- a/docs/versionhistory.rst
+++ b/docs/versionhistory.rst
@@ -7,6 +7,9 @@ This library adheres to `Semantic Versioning 2.0 <http://semver.org/>`_.
 
 - Added support for the Python 3.12 ``walk_up`` keyword argument in
   ``anyio.Path.relative_to()`` (PR by Colin Taylor)
+- Fixed passing ``total_tokens`` to ``anyio.CapacityLimiter()`` as a keyword argument
+  not working on the ``trio`` backend
+  (`#515 <https://github.com/agronholm/anyio/issues/515>`_)
 
 **4.2.0**
 
diff --git a/src/anyio/_backends/_trio.py b/src/anyio/_backends/_trio.py
index a0d14c7..13b960f 100644
--- a/src/anyio/_backends/_trio.py
+++ b/src/anyio/_backends/_trio.py
@@ -631,14 +631,24 @@ class Event(BaseEvent):
 
 class CapacityLimiter(BaseCapacityLimiter):
     def __new__(
-        cls, *args: Any, original: trio.CapacityLimiter | None = None
+        cls,
+        total_tokens: float | None = None,
+        *,
+        original: trio.CapacityLimiter | None = None,
     ) -> CapacityLimiter:
         return object.__new__(cls)
 
     def __init__(
-        self, *args: Any, original: trio.CapacityLimiter | None = None
+        self,
+        total_tokens: float | None = None,
+        *,
+        original: trio.CapacityLimiter | None = None,
     ) -> None:
-        self.__original = original or trio.CapacityLimiter(*args)
+        if original is not None:
+            self.__original = original
+        else:
+            assert total_tokens is not None
+            self.__original = trio.CapacityLimiter(total_tokens)
 
     async def __aenter__(self) -> None:
         return await self.__original.__aenter__()

diff --git a/tests/test_synchronization.py b/tests/test_synchronization.py
index 5eddc06..d6f68f6 100644
--- a/tests/test_synchronization.py
+++ b/tests/test_synchronization.py
@@ -689,3 +689,8 @@ class TestCapacityLimiter:
             backend=anyio_backend_name,
             backend_options=anyio_backend_options,
         )
+
+    async def test_total_tokens_as_kwarg(self) -> None:
+        # Regression test for #515
+        limiter = CapacityLimiter(total_tokens=1)
+        assert limiter.total_tokens == 1

On `trio` backend, `CapacityLimiter` does not take keyword arguments
MWE:
```
import anyio

async def test():
    lim = anyio.CapacityLimiter(total_tokens=1)
    async with lim:
        await anyio.sleep(0.5)
        
with anyio.start_blocking_portal(backend="trio") as portal:
    portal.start_task_soon(test).result()
```
fails with `TypeError: CapacityLimiter.__init__() got an unexpected keyword argument 'total_tokens'`.

This doesn't happen when supplying the tokens as positional arguments or when using the `asyncio` backend.



tests/test_synchronization.py::TestCapacityLimiter::test_total_tokens_as_kwarg[trio]
tests/test_synchronization.py::TestLock::test_contextmanager[asyncio] tests/test_synchronization.py::TestLock::test_contextmanager[asyncio+uvloop] tests/test_synchronization.py::TestLock::test_contextmanager[trio] tests/test_synchronization.py::TestLock::test_manual_acquire[asyncio] tests/test_synchronization.py::TestLock::test_manual_acquire[asyncio+uvloop] tests/test_synchronization.py::TestLock::test_manual_acquire[trio] tests/test_synchronization.py::TestLock::test_acquire_nowait[asyncio] tests/test_synchronization.py::TestLock::test_acquire_nowait[asyncio+uvloop] tests/test_synchronization.py::TestLock::test_acquire_nowait[trio] tests/test_synchronization.py::TestLock::test_acquire_nowait_wouldblock[asyncio] tests/test_synchronization.py::TestLock::test_acquire_nowait_wouldblock[asyncio+uvloop] tests/test_synchronization.py::TestLock::test_acquire_nowait_wouldblock[trio] tests/test_synchronization.py::TestLock::test_cancel_during_acquire[asyncio-releaselast] tests/test_synchronization.py::TestLock::test_cancel_during_acquire[asyncio-releasefirst] tests/test_synchronization.py::TestLock::test_cancel_during_acquire[asyncio+uvloop-releaselast] tests/test_synchronization.py::TestLock::test_cancel_during_acquire[asyncio+uvloop-releasefirst] tests/test_synchronization.py::TestLock::test_cancel_during_acquire[trio-releaselast] tests/test_synchronization.py::TestLock::test_cancel_during_acquire[trio-releasefirst] tests/test_synchronization.py::TestLock::test_statistics[asyncio] tests/test_synchronization.py::TestLock::test_statistics[asyncio+uvloop] tests/test_synchronization.py::TestLock::test_statistics[trio] tests/test_synchronization.py::TestLock::test_asyncio_deadlock[asyncio] tests/test_synchronization.py::TestLock::test_instantiate_outside_event_loop[asyncio] tests/test_synchronization.py::TestLock::test_instantiate_outside_event_loop[asyncio+uvloop] tests/test_synchronization.py::TestLock::test_instantiate_outside_event_loop[trio] tests/test_synchronization.py::TestEvent::test_event[asyncio] tests/test_synchronization.py::TestEvent::test_event[asyncio+uvloop] tests/test_synchronization.py::TestEvent::test_event[trio] tests/test_synchronization.py::TestEvent::test_event_cancel[asyncio] tests/test_synchronization.py::TestEvent::test_event_cancel[asyncio+uvloop] tests/test_synchronization.py::TestEvent::test_event_cancel[trio] tests/test_synchronization.py::TestEvent::test_event_wait_before_set_before_cancel[asyncio] tests/test_synchronization.py::TestEvent::test_event_wait_before_set_before_cancel[asyncio+uvloop] tests/test_synchronization.py::TestEvent::test_event_wait_before_set_before_cancel[trio] tests/test_synchronization.py::TestEvent::test_statistics[asyncio] tests/test_synchronization.py::TestEvent::test_statistics[asyncio+uvloop] tests/test_synchronization.py::TestEvent::test_statistics[trio] tests/test_synchronization.py::TestEvent::test_instantiate_outside_event_loop[asyncio] tests/test_synchronization.py::TestEvent::test_instantiate_outside_event_loop[asyncio+uvloop] tests/test_synchronization.py::TestEvent::test_instantiate_outside_event_loop[trio] tests/test_synchronization.py::TestCondition::test_contextmanager[asyncio] tests/test_synchronization.py::TestCondition::test_contextmanager[asyncio+uvloop] tests/test_synchronization.py::TestCondition::test_contextmanager[trio] tests/test_synchronization.py::TestCondition::test_manual_acquire[asyncio] tests/test_synchronization.py::TestCondition::test_manual_acquire[asyncio+uvloop] tests/test_synchronization.py::TestCondition::test_manual_acquire[trio] tests/test_synchronization.py::TestCondition::test_acquire_nowait[asyncio] tests/test_synchronization.py::TestCondition::test_acquire_nowait[asyncio+uvloop] tests/test_synchronization.py::TestCondition::test_acquire_nowait[trio] tests/test_synchronization.py::TestCondition::test_acquire_nowait_wouldblock[asyncio] tests/test_synchronization.py::TestCondition::test_acquire_nowait_wouldblock[asyncio+uvloop] tests/test_synchronization.py::TestCondition::test_acquire_nowait_wouldblock[trio] tests/test_synchronization.py::TestCondition::test_wait_cancel[asyncio] tests/test_synchronization.py::TestCondition::test_wait_cancel[asyncio+uvloop] tests/test_synchronization.py::TestCondition::test_wait_cancel[trio] tests/test_synchronization.py::TestCondition::test_statistics[asyncio] tests/test_synchronization.py::TestCondition::test_statistics[asyncio+uvloop] tests/test_synchronization.py::TestCondition::test_statistics[trio] tests/test_synchronization.py::TestCondition::test_instantiate_outside_event_loop[asyncio] tests/test_synchronization.py::TestCondition::test_instantiate_outside_event_loop[asyncio+uvloop] tests/test_synchronization.py::TestCondition::test_instantiate_outside_event_loop[trio] tests/test_synchronization.py::TestSemaphore::test_contextmanager[asyncio] tests/test_synchronization.py::TestSemaphore::test_contextmanager[asyncio+uvloop] tests/test_synchronization.py::TestSemaphore::test_contextmanager[trio] tests/test_synchronization.py::TestSemaphore::test_manual_acquire[asyncio] tests/test_synchronization.py::TestSemaphore::test_manual_acquire[asyncio+uvloop] tests/test_synchronization.py::TestSemaphore::test_manual_acquire[trio] tests/test_synchronization.py::TestSemaphore::test_acquire_nowait[asyncio] tests/test_synchronization.py::TestSemaphore::test_acquire_nowait[asyncio+uvloop] tests/test_synchronization.py::TestSemaphore::test_acquire_nowait[trio] tests/test_synchronization.py::TestSemaphore::test_cancel_during_acquire[asyncio-releaselast] tests/test_synchronization.py::TestSemaphore::test_cancel_during_acquire[asyncio-releasefirst] tests/test_synchronization.py::TestSemaphore::test_cancel_during_acquire[asyncio+uvloop-releaselast] tests/test_synchronization.py::TestSemaphore::test_cancel_during_acquire[asyncio+uvloop-releasefirst] tests/test_synchronization.py::TestSemaphore::test_cancel_during_acquire[trio-releaselast] tests/test_synchronization.py::TestSemaphore::test_cancel_during_acquire[trio-releasefirst] tests/test_synchronization.py::TestSemaphore::test_max_value[asyncio-2] tests/test_synchronization.py::TestSemaphore::test_max_value[asyncio-None] tests/test_synchronization.py::TestSemaphore::test_max_value[asyncio+uvloop-2] tests/test_synchronization.py::TestSemaphore::test_max_value[asyncio+uvloop-None] tests/test_synchronization.py::TestSemaphore::test_max_value[trio-2] tests/test_synchronization.py::TestSemaphore::test_max_value[trio-None] tests/test_synchronization.py::TestSemaphore::test_max_value_exceeded[asyncio] tests/test_synchronization.py::TestSemaphore::test_max_value_exceeded[asyncio+uvloop] tests/test_synchronization.py::TestSemaphore::test_max_value_exceeded[trio] tests/test_synchronization.py::TestSemaphore::test_statistics[asyncio] tests/test_synchronization.py::TestSemaphore::test_statistics[asyncio+uvloop] tests/test_synchronization.py::TestSemaphore::test_statistics[trio] tests/test_synchronization.py::TestSemaphore::test_acquire_race[asyncio] tests/test_synchronization.py::TestSemaphore::test_acquire_race[asyncio+uvloop] tests/test_synchronization.py::TestSemaphore::test_acquire_race[trio] tests/test_synchronization.py::TestSemaphore::test_asyncio_deadlock[asyncio] tests/test_synchronization.py::TestSemaphore::test_instantiate_outside_event_loop[asyncio] tests/test_synchronization.py::TestSemaphore::test_instantiate_outside_event_loop[asyncio+uvloop] tests/test_synchronization.py::TestSemaphore::test_instantiate_outside_event_loop[trio] tests/test_synchronization.py::TestCapacityLimiter::test_bad_init_type[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_bad_init_type[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_bad_init_type[trio] tests/test_synchronization.py::TestCapacityLimiter::test_bad_init_value[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_bad_init_value[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_bad_init_value[trio] tests/test_synchronization.py::TestCapacityLimiter::test_borrow[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_borrow[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_borrow[trio] tests/test_synchronization.py::TestCapacityLimiter::test_limit[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_limit[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_limit[trio] tests/test_synchronization.py::TestCapacityLimiter::test_borrow_twice[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_borrow_twice[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_borrow_twice[trio] tests/test_synchronization.py::TestCapacityLimiter::test_bad_release[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_bad_release[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_bad_release[trio] tests/test_synchronization.py::TestCapacityLimiter::test_increase_tokens[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_increase_tokens[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_increase_tokens[trio] tests/test_synchronization.py::TestCapacityLimiter::test_current_default_thread_limiter[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_current_default_thread_limiter[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_current_default_thread_limiter[trio] tests/test_synchronization.py::TestCapacityLimiter::test_statistics[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_statistics[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_statistics[trio] tests/test_synchronization.py::TestCapacityLimiter::test_asyncio_deadlock[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_ordered_queue[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_ordered_queue[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_ordered_queue[trio] tests/test_synchronization.py::TestCapacityLimiter::test_increase_tokens_lets_others_acquire[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_increase_tokens_lets_others_acquire[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_increase_tokens_lets_others_acquire[trio] tests/test_synchronization.py::TestCapacityLimiter::test_instantiate_outside_event_loop[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_instantiate_outside_event_loop[asyncio+uvloop] tests/test_synchronization.py::TestCapacityLimiter::test_instantiate_outside_event_loop[trio] tests/test_synchronization.py::TestCapacityLimiter::test_total_tokens_as_kwarg[asyncio] tests/test_synchronization.py::TestCapacityLimiter::test_total_tokens_as_kwarg[asyncio+uvloop]