#Add "has_completions" and "has_chat_completions" flags to the beta endpoints API.

23 messages · Page 1 of 1 (latest)

green coyote
#

Right now there is no way to tell if a provider will handle a completions request genuinely, right ?

If I try to make a completions request to a provider that does not handle it, it will still be processed but the response definitely looks like it's coming from a chat/completions answer. (mostly because it won't pickup where the user text ended)

Is your backend the one doing this transformation ? The response format is the completions format too.

My app works far better with completions since its purpose is to complete user's text. But in the case it has to fallback to chat/completions, it will send a finely crafted request with a role: "system" message and a prefilled role: "assistant" message, allowing far better results than the one you (supposedly) craft for me automatically.

Without any clue about what endpoint is supported by a provider, I can't programatically decide if I need to send a completions or a chat/completions request though.

Could you please add the has_completions and has_chat_completions flags to your public API ? These two only exist in your private one for now.

Or maybe add a way to let a completions query fails when the provider is declared as not supporting it.

Thanks

molten osprey
green coyote
#

awesome

#

in the meantime could you confirm if the described behaviour is actually coming from your backend ? is openrouter transforming my completions request to a chat/completions request I mean.

molten osprey
green coyote
#

thank you !

molten osprey
green coyote
#

Deepseek-r1 using DeepInfra

molten osprey
molten osprey
green coyote
#

hmmmm

#

thank you for coming back at me

#

I am not sure to fully understand then, if this transformation should not be triggered when calling the /completions endpoint... then what would trigger it ?

#

oh, alright, I think I get it

#

the transforming/nomalizing on your side should be called when my request's format is the one of a completions but send to the /chat/completions endpoint (just tested and it is indeed the case - my request is answered even when using a provider that does not support simple completions)

#

but yeah, this is also triggered when sending this same request to the /completions endpoint atm

#

so maybe a bug ?

molten osprey
green coyote
#

an example to help your team investigate :

my request for this test, the only field that changes is provider.order.

{
    "model": "deepseek/deepseek-r1",
    "prompt": "The cat was sitting ",
    "max_tokens": 64,
    "include_reasoning": true,
    "provider": {
        "order": [ "---" ],
        "allow_fallbacks": false
    }
}

/api/v1/completions to DeepInfra/Featherless (has_completions: false)

{
    "id": "???",
    "provider": "DeepInfra",
    "model": "deepseek/deepseek-r1",
    "object": "chat.completion",
    "created": 1738697755,
    "choices": [
        {
            "logprobs": null,
            "finish_reason": "length",
            "native_finish_reason": "length",
            "text": "",
            "reasoning": "\nOkay, so the user typed \"The cat was sitting\"... and then stopped. I need to figure out how to respond to that. Let's see, maybe they want to complete the sentence? The sentence starts with \"The cat was sitting,\" so the most likely thing is they want to finish the thought."
        }
    ],
    "usage": {
        "prompt_tokens": 8,
        "completion_tokens": 64,
        "total_tokens": 72
    }
}

/api/v1/completions to Nebius/Deepseek (has_completions: true)

{
    "id": "???",
    "provider": "Nebius",
    "model": "deepseek/deepseek-r1",
    "object": "chat.completion",
    "created": 1738697826,
    "choices": [
        {
            "logprobs": null,
            "finish_reason": "length",
            "native_finish_reason": "length",
            "text": "50 meters under the rock(岩石).She was going to have her kittens(小猫崽)there.She licked(舔) herself all over,Then she licked the area between her front legs.\n\nThat was the sign.Her first kitten was on the way.The cat opened her mouth to let out",
            "reasoning": null
        }
    ],
    "usage": {
        "prompt_tokens": 6,
        "completion_tokens": 64,
        "total_tokens": 70
    }
}
#

in the first case, the text field is empty because the max_tokens does not fit the reasoning and the actual answer but it's not important for this issue

green coyote
#

also, the is_disabled field would be useful since right now some providers are listed by the API but are actually disabled

#

(see Nebius for r1 for example)

green coyote
#

Hello, anything new about this ? Is this a confirmed bug ?