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

# Hosted API

> Call Bespoke-MiniCheck-7B through the Bespoke Labs API.

<Steps>
  <Step title="Get an API key">
    Create a key in the [Bespoke Labs console](https://console.bespokelabs.ai/home/keys). Then set it in your shell:

    ```bash theme={null}
    export BESPOKE_API_KEY="your-api-key"
    ```
  </Step>

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

  <Step title="Check a claim">
    <CodeGroup>
      ```python Sync theme={null}
      from bespokelabs import BespokeLabs

      client = BespokeLabs()  # Reads BESPOKE_API_KEY from the environment.

      response = client.minicheck.factcheck.create(
          claim="The students are preparing for an examination.",
          context="A group of students gather in the school library to study for their upcoming final exams.",
      )
      print(response.support_prob)
      ```

      ```python Async theme={null}
      import asyncio

      from bespokelabs import AsyncBespokeLabs

      client = AsyncBespokeLabs()  # Reads BESPOKE_API_KEY from the environment.

      async def main() -> None:
          response = await client.minicheck.factcheck.create(
              claim="The students are preparing for an examination.",
              context="A group of students gather in the school library to study for their upcoming final exams.",
          )
          print(response.support_prob)

      asyncio.run(main())
      ```
    </CodeGroup>
  </Step>
</Steps>

## Request and response

`client.minicheck.factcheck.create` sends a `POST` request to `/v0/minicheck/factcheck`. It takes two arguments:

* `claim` is the sentence to check.
* `context` is the document to check the claim against.

The response has one field. `support_prob` is a float from 0 to 1, and it is the probability that the context supports the claim.

For all SDK options, see the [SDK repository](https://github.com/bespokelabsai/bespokelabs-python).
