Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lizard-LLM Community

  1. Home
  2. General Discussion
  3. Using Lizard from your own code (Python, Node, curl)

Using Lizard from your own code (Python, Node, curl)

Scheduled Pinned Locked Moved General Discussion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lizardadmin
    wrote on last edited by
    #1

    Lizard serves the same API as OpenAI, on your machine. If you already have code written against a cloud AI service, you usually change one line.

    Start the server first:

    lizard-llm serve --model active
    

    Python

    from openai import OpenAI
    client = OpenAI(base_url="http://127.0.0.1:8013/v1", api_key="lizard-local")
    res = client.chat.completions.create(
        model="active",
        messages=[{"role": "user", "content": "Hello"}],
    )
    print(res.choices[0].message.content)
    

    Node.js

    import OpenAI from "openai";
    const client = new OpenAI({ baseURL: "http://127.0.0.1:8013/v1", apiKey: "lizard-local" });
    

    curl

    curl http://127.0.0.1:8013/v1/chat/completions \
      -H "Content-Type: application/json" \
      -d '{"model":"active","messages":[{"role":"user","content":"Hi"}]}'
    

    The key is ignored — nothing leaves your computer — but most clients insist on a value, so give it anything.

    Anything that reads OPENAI_BASE_URL (LangChain, LlamaIndex, lots of editor plugins) can point at Lizard the same way:

    OPENAI_BASE_URL=http://127.0.0.1:8013/v1
    OPENAI_API_KEY=lizard-local
    

    Full docs: https://lizard-llm.qendryx.com/docs.html

    What have you wired it into?

    1 Reply Last reply
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    Powered by NodeBB Contributors
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups