# Generating code samples for your SDK
Source: https://speakeasy.com/docs/sdks/sdk-docs/code-samples/generate-code-samples

import { Callout } from "@/mdx/components";



This guide explains how code samples are generated for an SDK and how to apply them to an OpenAPI document.

## What is the code samples extension?

Many API documentation providers provide code snippets in multiple languages to help developers understand how to use the API. However, these snippets
may not correspond to a usage snippet from an existing SDK provided by the API, which reduces the value of the API documentation and can lead to inconsistent integrations, depending on whether a user discovers the API docs or the SDK first.

The `x-codeSamples` extension (previously called `x-code-samples`) is a widely accepted OpenAPI Specification extension that enables the addition of custom code samples in multiple languages to operation IDs in an OpenAPI document.
When custom code samples are added using the code samples extension, documentation providers will render the usage snippet in the right-hand panel of the documentation page:

For a full breakdown of the code samples extension, see our [guide](/guides/openapi/x-codesamples).

## Configuring code samples

Speakeasy provides code samples in the form of [overlays](/docs/prep-openapi/overlays/create-overlays#what-are-overlays). This ensures that your code samples can be trivially applied to your OpenAPI document without needing to upstream the changes.

The setup for using overlays to apply code samples is configured in your workflow file, as follows:

```yaml filename=".speakeasy/workflow.yaml"