Skip to main content
This guide provides simple, practical examples for common Claro SDK tasks. Perfect for getting started quickly.

Prerequisites

Example 1: Fetch and Display a Prompt

The simplest way to fetch a prompt and display its content:

Example 2: Use Prompt with OpenAI

Integrate a Claro prompt with OpenAI’s API:
When your team updates the prompt in Claro, your next API call automatically gets the latest version. No code changes needed.

Example 3: Use Prompt with Anthropic

Use a Claro prompt with Claude:

Example 4: Access Prompt Properties

Explore different properties of a prompt:

Example 5: Dictionary-Style Access

Access prompt fields using dictionary syntax:

Example 6: Working with Versions

Fetch different versions of the same prompt:
  • :v0 is always the draft version
  • :v1, :v2, etc. are published versions
  • :latest points to the most recent published version

Example 7: Browse Your Prompts

List all prompts in your workspace:

Example 8: Simple Error Handling

Handle common errors gracefully:

Example 9: Use with Multiple Providers

Create a helper function to use prompts with any LLM provider:

Example 10: Check Prompt Properties Before Use

Validate a prompt has the content you need:

Next Steps

File Downloads

Learn how to download and use context files

Pagination

Iterate through all your prompts

Error Handling

Robust error handling patterns

Advanced Patterns

Production-ready patterns and optimizations

Need Help?

If you get stuck: