WireMock Cloud

A Mock API for Developing and Testing Generative AI Apps

If you're building on OpenAI APIs (such as the ChatGPT API), you know that testing API calls can be expensive and slow.

MockGPT is a free tool powered by WireMock Cloud that allows you to build and test your ChatGPT-powered app against a dummy API by simply changing two config parameters (or the equivalent lines of code).

You can use this public version of MockGPT right away for basic testing or create your own free copy in WireMock Cloud for more advanced customisation.

Or take a look at this article if you'd like to learn a little more before diving in.

API documentation

How to use

  • Set the base URL used by your ChatGPT client code to https://mockgpt.wiremockapi.cloud/v1.
  • Set the API key to
    (this key is unique to you).
  • Make a request to get a chat completion and receive the default stubbed response (fast!). See code examples.
  • Set the next response via the text box below then make another completion request and receive the response you configured.
  • When you're ready to switch to the live API, simply switch back the base URL and API key parameters and you're good to go!

Example code

    
                  

    Ready to go live?

    Replace openai.api_key with your actual OpenAI API key and remove openai.api_base (or replace with the relevant address for Azure OpenAI).

    Want A Fully Customisable Mock?

    Simulate different API responses, response delays, and rate limits with WireMock Cloud!

    • Create any number of responses corresponding to specific prompts, model or tuning parameters.
    • Simulate faults on demand
    • Create stateful sequences of responses using the Scenarios feature

    A free-forever account gets you 1000 API calls each month.

    Create my own MockGPT for free

    Additional Information

    Testing your ChatGPT-powered app against the real OpenAI API can be challenging:

    • Responses can take seconds or even minutes to arrive
    • Each API call costs money, and can quickly get expensive for longer prompts or more powerful models
    • Non-deterministic responses make it hard to test specific cases reliably
    • Due to these reasons, CI/CD is impractical

    WireMock allows you to mock the OpenAI API and create realistic testing scenarios, without the lengthy waits and high costs associated with testing against the live API.

    If you'd like to learn more about how WireMock helps you mock the APIs you depend on, check out the open-source library or explore WireMock Cloud.