> ## Documentation Index
> Fetch the complete documentation index at: https://surfacedocs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Save your first AI-generated document in under 5 minutes

# Quickstart

<Steps>
  <Step title="Install the SDK">
    ```bash theme={null}
    pip install surfacedocs
    ```
  </Step>

  <Step title="Get your API key">
    Sign up at [app.surfacedocs.dev](https://app.surfacedocs.dev) and create an API key from your dashboard. Keys start with `sd_live_`.

    You can pass it directly or set it as an environment variable:

    ```bash theme={null}
    export SURFACEDOCS_API_KEY=sd_live_...
    ```
  </Step>

  <Step title="Generate and save a document">
    Choose your LLM provider:

    <Tabs>
      <Tab title="OpenAI">
        ```python theme={null}
        from surfacedocs import SurfaceDocs, DOCUMENT_SCHEMA, SYSTEM_PROMPT
        from openai import OpenAI

        openai = OpenAI()
        docs = SurfaceDocs()

        response = openai.chat.completions.create(
            model="gpt-4o",
            messages=[
                {"role": "system", "content": SYSTEM_PROMPT},
                {"role": "user", "content": "Write documentation for user authentication"},
            ],
            response_format={
                "type": "json_schema",
                "json_schema": {"name": "document", "schema": DOCUMENT_SCHEMA},
            },
        )

        result = docs.save(response.choices[0].message.content)
        print(f"Saved: {result.url}")
        ```
      </Tab>

      <Tab title="Gemini">
        ```python theme={null}
        from surfacedocs import SurfaceDocs, DOCUMENT_SCHEMA, SYSTEM_PROMPT
        import google.generativeai as genai

        genai.configure(api_key="...")
        docs = SurfaceDocs()

        model = genai.GenerativeModel(
            model_name="gemini-2.0-flash",
            system_instruction=SYSTEM_PROMPT,
            generation_config=genai.GenerationConfig(
                response_mime_type="application/json",
                response_schema=DOCUMENT_SCHEMA,
            ),
        )

        response = model.generate_content("Write documentation for user authentication")
        result = docs.save(response.text)
        print(f"Saved: {result.url}")
        ```
      </Tab>

      <Tab title="Anthropic">
        ```python theme={null}
        from surfacedocs import SurfaceDocs, DOCUMENT_SCHEMA, SYSTEM_PROMPT
        import anthropic

        client = anthropic.Anthropic()
        docs = SurfaceDocs()

        response = client.messages.create(
            model="claude-sonnet-4-20250514",
            max_tokens=4096,
            system=SYSTEM_PROMPT,
            messages=[
                {"role": "user", "content": "Write documentation for user authentication"},
            ],
            tools=[{
                "name": "create_document",
                "description": "Create a structured document",
                "input_schema": DOCUMENT_SCHEMA,
            }],
            tool_choice={"type": "tool", "name": "create_document"},
        )

        tool_use = next(b for b in response.content if b.type == "tool_use")
        result = docs.save(tool_use.input)
        print(f"Saved: {result.url}")
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="View your document">
    Open the URL printed in the previous step. Your document is live and shareable at `https://app.surfacedocs.dev/d/...`.
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="Python SDK Reference" icon="python" href="/sdk/overview">
    Explore all SDK methods and models.
  </Card>

  <Card title="LLM Providers" icon="microchip-ai" href="/providers/openai">
    Detailed guides for each LLM provider.
  </Card>
</CardGroup>
