For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Book a demoLog inStart for free
  • Overview
    • Introduction
    • How it works
    • Quickstart
    • Customer showcase
  • Working with SDKs
    • Project structure
    • Adding custom code
    • Migrating to Replay
    • Capabilities
  • Generators
      • Generating an SDK
      • Publishing to PyPI
      • Configuration
      • Adding custom code
      • Dynamic authentication
      • aiohttp support
      • Changelog
      • Customer showcase
  • Reference
    • generators.yml
Checking status...
SOC2Soc 2 Type II
© 2026 Fern • Birch Solutions, Inc., a Postman company

Documentation

SDKsDocsAsk FernCLI Reference

API Definitions

OpenAPIAsyncAPIOpenRPCgRPC

Resources

BlogSupportPricing

Company

Brand KitPrivacy PolicyTerms of Service
LogoLogo
Book a demoLog inStart for free
On this page
  • Adding custom logic
  • Adding custom SDK methods
  • Adding custom dependencies
GeneratorsPython

Adding custom code

||View as Markdown|
Was this page helpful?
Edit this page
Previous

Python configuration

Next

Dynamic authentication

This page covers how to add custom logic, methods, and dependencies to your Python SDK.

Adding custom logic

To get started adding custom code:

These steps cover adding a new custom file to the SDK. To preserve line-level edits to a generated file, use Replay instead.
1

Create a new file and add your custom logic

src/<package>/helper.py
1def my_helper() -> None:
2 print("Hello World!")
2

Add your file to .fernignore

.fernignore
1# Specify files that shouldn't be modified by Fern
2
3src/<package>/helper.py
3

Consume the helper

Now your users can consume the helper function by importing it from the SDK.

1from package.helper import my_helper
2
3my_helper()

Adding custom SDK methods

Fern also allows you to add custom methods to the SDK itself (e.g. client.my_method() ) by inheriting the Fern generated client and then extending it.

See an example from ElevenLabs using this process in their Python SDK.

1

Update generators.yml configuration

Name your Fern-generated client something like BaseClient to reflect that this client will be extended. Configure the generator to output the client in a file called base_client.py.

generators.yml
1- name: fernapi/fern-python-sdk
2 version: "..."
3 config:
4 client:
5 class_name: BaseClient # The name of the generated client you will extend
6 filename: base_client.py # The name of the file the generated client will live in
7 exported_class_name: YourClient # The name of the class you will be creating that extends the generated client
8 exported_filename: client.py
2

Generate the SDK

Trigger SDK generation by running fern generate:

$fern generate --group sdk
3

Import and extend the generated client

First, import the Fern generated base clients from .base_client.py and extend them to create your custom clients. Then, add whatever methods you want.

src/<package>/client.py
1 from .base_client import BaseClient // import generated client
2
3 class YourClient(BaseClient): // extend generated client
4 def my_helper(self) -> None:
5 print("Hello World!")
6 def my_helper(self) -> None:
7 print("Hello World")

See an example client.py from ElevenLabs.

4

Update .fernignore

Add the client.py to .fernignore.

.fernignore
1+ src/<package>/client.py

See an example .fernignore from ElevenLabs.

5

Consume the method

Now your users can consume the helper function by importing it from the SDK.

1client.my_helper()

Adding custom dependencies

Enterprise feature

This feature is available only for the Enterprise plan. To get started, reach out to support@buildwithfern.com.

To add packages that your custom code requires, update your generators.yml.

generators.yml
1- name: fernapi/fern-python-sdk
2 version: "..."
3 config:
4 extra_dependencies:
5 numpy: '1.2.0'
6 extra_dev_dependencies:
7 requests_mock: '1.12.1'