Models

When making an API request, you can decide which sources are used as context:

  • Infer relevant Lunes from query: By just passing in the default Tycho mode, relevant Lunes to use as sources will be inferred from your query.
  • Specify individual Lunes: To override the default context-switching behavior for Tycho, you can pass an additional lunes parameter to have fine control over sources.

Tycho

The Tycho model is a context switching model that automatically infers relevant Lunes from queries. It currently uses Claude-3.5-Sonnet as the underlying model, and automatically switches to GPT-4o for structured output use cases.

From the following request, it automatically infers to use the Keras and Tensorflow Lunes and returns the respective URL references in the response object.

Request

curl https://api.trylune.ai/chat/completions \
  -H "Authorization: Bearer $LUNE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tycho",
    "messages": [
      {
        "role": "system",
        "content": "You are a documentation assistant"
      },
      {
        "role": "user",
        "content": "How can I get started building a simple LSTM model in Keras and Tensorflow?"
      }
    ],
    "stream": true
}'

Response

{
    "id": "chatcmpl-1730147034663631581", 
    "choices": [
        {
            "delta": {
                "content": ".", 
                "function_call": null, 
                "refusal": null, 
                "role": null, 
                "tool_calls": null
            }, 
            "finish_reason": null, 
            "index": 0, 
            "logprobs": null
            }
        ], 
    "created": 1730147034, 
    "model": "tycho", 
    "object": "chat.completion.chunk", 
    "service_tier": null, 
    "system_fingerprint": 
    "fp_e2bde53e6e", 
    "usage": null, 
    "url_references": [
        "https://keras.io/api/layers/recurrent_layers/lstm", 
        "https://keras.io/api/layers/recurrent_layers/lstm_cell", 
        "https://keras.io/api/layers/recurrent_layers/simple_rnn", 
        "https://keras.io/api/layers/recurrent_layers/simple_rnn_cell", 
        "https://keras.io/api/layers/recurrent_layers/conv_lstm1d", 
        "https://www.tensorflow.org/api_docs/python/tf/keras/layers/Masking", 
        "https://www.tensorflow.org/api_docs/python/tf/compat/v1/train/exponential_decay",
        "https://www.tensorflow.org/api_docs/python/tf/raw_ops/CudnnRNN", 
        "https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/schedules/InverseTimeDecay", 
        "https://www.tensorflow.org/api_docs/python/tf/keras/legacy/saving/serialize_keras_object"
    ]
}

This is good for general use cases where flexibility is important. For example, when using a personal API key for external integrations such as Cursor, the chat completions endpoint will use the default Tycho model.

Individual Lunes

If you want to explicitly limit the response to a specific Lune or a list of Lunes, you can do so by passing in the lunes parameter.

Let's take the tycho example above and limit the response to only the tensorflow Lune by setting the lunes parameter to the Lune ID of the tensorflow Lune 6297be51-5179-48bf-94ad-06848703f7a0.

You can copy the Lune ID for each Lune from the Explore or My Lunes.

Request

curl https://api.trylune.ai/chat/completions \
  -H "Authorization: Bearer $LUNE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "tycho",
    "messages": [
      {
        "role": "system",
        "content": "You are a documentation assistant"
      },
      {
        "role": "user",
        "content": "How can I get started building a simple LSTM model in Keras and Tensorflow?"
      }
    ],
    "lunes": ["6297be51-5179-48bf-94ad-06848703f7a0"],
    "stream": true
}'

Response

{
    "id": "chatcmpl-1730146961885964210", 
    "choices": [
        {
            "delta": {
                "content": "EarlyStopping", 
                "function_call": null,
                "refusal": null, 
                "role": null, 
                "tool_calls": null
            }, 
            "finish_reason": null, 
            "index": 0, 
            "logprobs": null
        }
    ], 
    "created": 1730146961, 
    "model": "tycho", "object": 
    "chat.completion.chunk", 
    "service_tier": null, 
    "system_fingerprint": "fp_e2bde53e6e", 
    "usage": null, 
    "url_references": [
        "https://www.tensorflow.org/api_docs/python/tf/keras/layers/Masking", 
        "https://www.tensorflow.org/api_docs/python/tf/compat/v1/train/exponential_decay",
        "https://www.tensorflow.org/api_docs/python/tf/raw_ops/CudnnRNN", 
        "https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/schedules/InverseTimeDecay", 
        "https://www.tensorflow.org/api_docs/python/tf/keras/legacy/saving/serialize_keras_object"
    ]
}

The response now only contains url references from the tensorflow Lune. This is better for use cases where you need fine control over your sources and need the lowest latency. For example, an application that relies on generating front-end code for React and NextJS might specify those respective Lunes as the only source when making API calls.